hi All,
I have created macro variables
%let B1=123;
%let B2=231;
%let B3=8;
Trying to call these inside a do loop.
data one;
array var[3] first second third ;
do j = 1 to 3;
var[j]= &Bj.;
end;
run;
The above code does not work. Please suggest
Macro variables are normally resolved during datastep compilation, so in order to get at them dynamically in a datastep, you will have to use SYMGET:
data one;
array var[3] 8 first second third ;
do j = 1 to 3;
var[j]= input(symget(cats('B',j)),best32.);
end;
run;
Macro variables are normally resolved during datastep compilation, so in order to get at them dynamically in a datastep, you will have to use SYMGET:
data one;
array var[3] 8 first second third ;
do j = 1 to 3;
var[j]= input(symget(cats('B',j)),best32.);
end;
run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.