BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
duanzongran
Obsidian | Level 7

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 !

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

%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).;

View solution in original post

2 REPLIES 2
Patrick
Opal | Level 21

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;
Tom
Super User Tom
Super User

%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).;
How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1019 views
  • 4 likes
  • 3 in conversation