BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
hein68
Quartz | Level 8

How do I get this code to work?

 

if callfreqothc=""sick Person"" then callfreqothc="Sick Person";
                            __
                            49
                              ____
                              388
                              76

This is the message I'm getting in the log:


NOTE 49-169: The meaning of an identifier after a quoted string might change in
             a future SAS release.  Inserting white space between a quoted

 

Thanks!
             string and the succeeding identifier is recommended.

1 ACCEPTED SOLUTION

Accepted Solutions
Lucy1
Fluorite | Level 6

If you are familiar with the macro language you could use quoting functions to mask the inner quotes ... the following should work:

data want;  
  callfreqothc='"sick Person"';
  if callfreqothc="%str(%"sick Person%")" then callfreqothc="Sick Person";
run;

The %str() function masks characters that you don't want their meaning interpreted. This needs to be supplemented with individual % signs just before each quote you want to mask 

View solution in original post

6 REPLIES 6
Lucy1
Fluorite | Level 6

If you are familiar with the macro language you could use quoting functions to mask the inner quotes ... the following should work:

data want;  
  callfreqothc='"sick Person"';
  if callfreqothc="%str(%"sick Person%")" then callfreqothc="Sick Person";
run;

The %str() function masks characters that you don't want their meaning interpreted. This needs to be supplemented with individual % signs just before each quote you want to mask 

Tom
Super User Tom
Super User

There is no need to get the macro processor involved. The SAS language already has methods to represent strings with quotes in them.

tomrvincent
Rhodochrosite | Level 12
use the unquote function. Example:

%qsysfunc(compress(&Grouplist,%str(%")))
Tom
Super User Tom
Super User

You can use different type of quotes on the outside.

if callfreqothc='"sick Person"' then callfreqothc="Sick Person";

Or double any internal quote characters that match the outside quote characters.

if callfreqothc="""sick Person""" then callfreqothc="Sick Person";
novinosrin
Tourmaline | Level 20

Or a bquote instead 

 

if callfreqothc="%bquote("sick Person")" then callfreqothc="Sick Person";

 

Or something fancy with informat and function

 

  callfreqothc=propcase(input(callfreqothc, $quote15.));

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 6 replies
  • 881 views
  • 3 likes
  • 6 in conversation