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

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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