Hi,
I'm putting together some code to check valid values. If it isn't in the valid values, it would be put into the dataset, tmp.
However, one of the valid values contains an ampersand. How do I trick SAS so it doesn't think it is a macro.
I have simplified the code I actually wrote to the part I'm having issues with
Just use single quotes around the value instead of double quotes and the macro processor will ignore the content of the string.
%colorchk(Color,'Black&White' "Purple" "Blue" "Red");
Just use single quotes around the value instead of double quotes and the macro processor will ignore the content of the string.
%colorchk(Color,'Black&White' "Purple" "Blue" "Red");
Thanks Tom!
That does seem to work. A similar question, I also have a pdf with frequencies being produced. in this pdf, I was also outputting the valid values from the macro statement.
However, the warnings also appear for that too.
This is the code I have:
ods pdf text="^{style [font_face=arial font_weight=Bold font_size=14pt color=blue just=center] &var1.}";
proc freq data=Test_Data;
table Group*&var1./list missing;
run;
ods pdf text="^{style [font_face=arial font_size=12pt color=blue just=center] &var1. has no out of range observations}";
ods pdf text="^{style [font_face=arial font_size=12pt color=blue just=center] Possible values: %bquote(&var2.)}";
The last line is what also gives the warning:
WARNING: Apparent symbolic reference WHITE not resolved.
WARNING: Apparent symbolic reference WHITE not resolved.
If you don't want the & evaluated then don't use %BQUOTE(). That is one of the main reason TO use %BQUOTE() is to quote values that are enclosed in single quotes.
You might use %SUPERQ() instead to add macro quoting. Pass just the NAME of the macro variable whose value you want quoted.
ods pdf text="^{style [font_face=arial font_size=12pt color=blue just=center] Possible values: %superq(var2)}";
Tom - Thank you so much for your help! It cleaned up the log and still gave me the output I was looking for! Thanks again
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.