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).;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.