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
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 |
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 ¯ovar1; /*display*/
Is This Answer Correct ? | 1 Yes | 0 No |
How would you include common or reuse to be processed along with your statements?
what is the use of sas management console? : Sas-di
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;
what is the difference between unique key and primary key? : Sas-di
What is the purpose of using the N=PS option?
If you were told to create many records from one record show how you would do this using arrays and with PROC TRANSPOSE?
What is highest missing value for numeric?
how will you location sas platform applications available from web browser? : Sas-bi
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?
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?