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).;
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: