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 |
Can we use where and having clauses in a single SAS program. ex: proc sql; select a,b,c from test where state in 'KA' and having <some condition>. Is the above program run correctly, if not why ?
How would you determine the number of missing or nonmissing values in computations?
what is the SAS/ACCESS and SAS/CONNECT?
9 Answers Accenture, iFlex, TCS,
Given an unsorted data set, how to read the last observation to a new data set?
how do you want missing values handled? : Sas programming
how to change the execute of macro
What is the command used to find missing values?
Give some examples where proc report’s defaults are same as proc print’s defaults?
how can you get the single data set from the library(which has the number of data sets)?
3 Answers Accenture, Deloitte,
what is option year cuttoff in sas
Name statements that function at both compile and execution time?
What can be the size of largest dataset in SAS?