dear all:
I want to put the macro variable just it seems like without resoving % or &.
here's the code:
data test;
length a $255.;
input a $;
datalines;
xx&xx
yy%yy
;
run;
proc sql;
select a into:a_list separated by " " from test;
quit;
%put &a_list.;
data _null_;
file "c:\test.txt";
put "&a_list.";
run;
when %put &a_list.; xx&xx yy%yy is expected;
when put "&a_list."; in data step xx&xx yy%yy is expected in the txt file;
but,there's always two warnings :
WARNING: Apparent symbolic reference XX not resolved.
WARNING: Apparent invocation of macro YY not resolved.
What should i do to make it without warnings?
Thanks in advance !
%SUPERQ() is a good way to add macro quoting to a macro variable's value.
%put The value of A_LIST is %superq(a_list).;
Below how you can write to value of the macro variable to an output destination (print and log in below sample code).
data test;
length a $255.;
input a $;
datalines;
xx&xx
yy%yy
;
proc sql noprint;
select a into:a_list separated by " "
from test;
quit;
data _null_;
file print;
m_value=symget("a_list");
put m_value;
putlog m_value;
run;
%SUPERQ() is a good way to add macro quoting to a macro variable's value.
%put The value of A_LIST is %superq(a_list).;
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.