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 would the following datastep do? Data _null_; Set Dist end=eof; Call Symput("xx"!!left(put(_n_,2.)),&dimension); If EOF then Call Symput('numrows',left(put(_n_,2.))); Run; dimension is a macro variable that is being passed here

2 Answers  


explain the main difference between the nodup and nodupkey options? : Sas-administrator

0 Answers  


what is the frontend and backend of sas? Is sas is a progaming langauge or tool? on which langauge sas depends?

3 Answers  


Can you execute macro within another macro? If so, how would sas know where the current macro ended and the new one began? : sas-macro

0 Answers  


. Which date advances a date, time or date/time value by a given interval?

8 Answers  






Which function is used to count the number of intervals between two sas dates?

0 Answers  


which stats created by proc means that are not created by proc summary or vice versa?

2 Answers   GSK,


Are you familiar with special input delimiters? How are they used?

4 Answers   Accenture,


Explain the special input delimiters used in sas programming.

0 Answers  


how can you improve the performance of a query, If it is excuting very slowly?

2 Answers   Zensar,


What is the purpose of _character_ and _numeric_?

0 Answers  


i want for interview question & answer plz it need immediate send t my mail raviprakashmot@gmal.cm

0 Answers   SAS,


Categories