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

Ready to join fellow brilliant minds for the SAS Hackathon?

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!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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