Hi All,
I am having a question regarding how to mask "&" in data steps:
Now I have a variable called "A&C name" in a table, when I call this variable using "A&C name"n, it returns an error showing that SAS interprets "&" as start of a macro var. I wonder how I can mask "&" here? I tried to search the discussions but didn't find a close match.
Thanks for your help!
Use single quotes, not double quotes. Or if for some reason double-quotes are mandatory (I can't think of a reason why it would be mandatory, but maybe...) use %nrstr(&)
Use single quotes, not double quotes. Or if for some reason double-quotes are mandatory (I can't think of a reason why it would be mandatory, but maybe...) use %nrstr(&)
Hi @PaigeMiller , thanks for helping out. Single quote works for me. Feel like this is one of those rare cases double quote is not working in SAS.
@brokenpc1 wrote:
Hi @PaigeMiller , thanks for helping out. Single quote works for me. Feel like this is one of those rare cases double quote is not working in SAS.
SAS is doing what it is supposed to be doing when you use double-quotes, but that doesn't seem to be what you want it to do.
@PaigeMiller wrote:
@brokenpc1 wrote:
Hi @PaigeMiller , thanks for helping out. Single quote works for me. Feel like this is one of those rare cases double quote is not working in SAS.
SAS is doing what it is supposed to be doing when you use double-quotes, but that doesn't seem to be what you want it to do.
Did anyone else notice that each reply seems to be doubling the & in the subject line?
Yes, I see it. Calling @ChrisHemedinger
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.