- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
WARNING: Apparent symbolic reference WHITE not resolved.
WARNING: Apparent symbolic reference WHITE not resolved.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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");
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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");
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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)}";
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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