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 do you define proc in sas? : sas-grid-administration
explain the proc in sas? : Sas-administrator
what is the difference between SET and MERGE?
What is interleaving in SAS?
Under what circumstances would you code a SELECT construct instead of IF statements?
What is PDV?
How substr function works in sas?
Explain the message 'Merge has one or more datasets with repeats of by variables'.
What do you feel about hardcoding?
what is data integration? : Sas-di
How do you debug and test your SAS programs? What can you learn from the SAS log when debugging? How do you test for missing values? How would you create multiple observations from a single observation? What are some good SAS programming practices for processing very large data sets? Briefly describe 5 ways to do a "table lookup" in SAS. Why is SAS considered self-documenting? Are you sensitive to code walk-throughs, peer review, or QC review? What other SAS features do you use for error trapping and data validation? How does SAS handle missing values in: assignment statements, functions, a merge, an update, sort order, formats, PROCs?
what is business intelligence? : Sas-bi