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

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.

 

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
  • 921 views
  • 0 likes
  • 3 in conversation