If you need the value of a variable rather than the
variable itself what would you use to load the value to a
macro variable?

Answers were Sorted based on User's Feedback



If you need the value of a variable rather than the variable itself what would you use to load the..

Answer / chaitanya

If we need a value of a macro variable then we must define
it in such terms so that we can call them everywhere in the
program. Define it as Global. There are different ways of
assigning a global variable. Simplest method is %LET.

Ex: A, is macro variable. Use following statement to assign
the value of a rather than the variable itselfe.g.

%Let A=xyz x="&A";

This will assign "xyz" to x, not the variable xyz to x.

Is This Answer Correct ?    1 Yes 0 No

If you need the value of a variable rather than the variable itself what would you use to load the..

Answer / damwal

Use CALL SYMPUT routine.
Below I show how to assign the value of 3rd observation of
variable name (94) to a macro variable named "macrovar1"

data test;
input name @@;
datalines;
1 21 94 444 5
;

data _null_;
set test (firstobs=3 obs=3);
call symput("macrovar1",name);
run;

%put &macrovar1; /*display*/

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More SAS Interview Questions

How would you include common or reuse to be processed along with your statements?

0 Answers  


what is the use of sas management console? : Sas-di

0 Answers  


In the following DATA step, what is needed for ‘fraction’ to print to the log? data _null_; x=1/3; if x=.3333 then put ‘fraction’; run;

1 Answers  


what is the difference between unique key and primary key? : Sas-di

0 Answers  


What is the purpose of using the N=PS option?

2 Answers   Oracle,






If you were told to create many records from one record show how you would do this using arrays and with PROC TRANSPOSE?

1 Answers   HCL, Quintiles,


What is highest missing value for numeric?

1 Answers  


how will you location sas platform applications available from web browser? : Sas-bi

0 Answers  


Baseline definition in your study

3 Answers   Accenture, Quintiles,


i have a dataset with var1,var2,var3; i want to upload the titles for the variables . How can we?

1 Answers   GSK,


how to display duplicated observations in a data using base sas.

13 Answers   HCL, TCS,


When merging 2 datasets with a common variable (not merge key), how to keep both?

3 Answers  


Categories