BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Im having a problem with the ampersand quoted after then in the statement below because i've used double quotes SAS thinks that the ampersand is the start of a macro, now the usual way to get round it would be to use single quotes but i can't do this because Italy has an apostrophe and SAS think its end of quote. is there a way of getting round this?

Case
When TotalTours.Brand = "J" and TotalTours.Description = 'Innsbruck & Lake Garda' then "Innsbruck & Italy's Lake Garda" end
3 REPLIES 3
LinusH
Tourmaline | Level 20
I tried your code and had no problem. Could you attach the log showing your problem?

Regards,
Linus
Data never sleeps
deleted_user
Not applicable
the base SAS language includes a function to "hide" the ampersand from normal macro variable handling.
However, since your code is not executing within a macro, the solution is even simpler: Just use single quotes (and repeat any embedded single quote)
Try [pre] then 'Innsbruck & Italy''s Lake Garda' [/pre]

PeterC
Patrick
Opal | Level 21
Single quotes is sure the easiest solution here.
I think what Peter_c is talking about is %nrstr(....).
This means NoResolveString: The macro processor won't resolve the string - especially characters like '&' and '%' with meaning in SAS macro language - but single quotes have the same effect.
HTH
Patrick

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1984 views
  • 0 likes
  • 3 in conversation