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

WHAT DOES A SAS SPECIFICATION DOCUMENT SDS CONTAIN ?

1 Answers  


Difference between nodup and nodupkey options?

0 Answers  


Have you been involved in editing the data or writing data queries?

1 Answers   BioServe, Oracle, Sasken,


% let A=3+4 what is result

4 Answers   Satyam,


I have a dataset with variables empid and doj how to calculate retirement age?

1 Answers  






/*i have the following dataset.*/ data score; input marks ; datalines; 10 20 30 40 50 60 70 80 90 100 ; run; Now i should get the result as sum of 1 to 5 i.e(10+20+30+40+50)=150 and 2 to 6 i.e(20+30+40+50+60)=200 and 3 to 7 i.e(30+40+50+60+70)=250 and so on. how to get it. thanks in advance

2 Answers   Eval Source,


I am having a stored process.it needs to route my report to both hthml and Xls.By default SP routes to html.I used the PRINTTO to route the html to Xls.BUt it createsthe file not but no content was written to file(0KB)?how can i do it?

1 Answers  


how does sas handle missing values in assignment statements? : Sas programming

0 Answers  


Do you prefer Proc Report or Proc Tabulate? Why?

9 Answers   Oracle,


i want to upload titles and footnotes to excel file?how it is possible?

1 Answers  


What is proc sort?

0 Answers  


Can Some one Explain How the Datasets from SAS can be loaded in to the MVS OS?

1 Answers   HCL,


Categories