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
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.