BookmarkSubscribeRSS Feed
deleted_user
Not applicable
%let names=%nrstr(O%'DONOVAN&O%'HARA&O%'MALLEY);
%let name3=%qscan(&names,3);
%put WITH NRSTR Quoting Function NAMES=&names;
%put WITH NRSTR Quoting Function NAME 3 is: &name3;

What is the equivalent code is sas with %nrbquote in the previous code.

i wrote the code but it throws warning,

%let names=%nrbquote(O'DONOVAN&O'HARA&O'MALLEY);
%let name3=%qscan(&names,3);
%put WITH NRSTR Quoting Function NAMES=&names;
%put WITH NRSTR Quoting Function NAME 3 is: &name3;

Thanks in advance.
murali
2 REPLIES 2
Resa
Pyrite | Level 9
I do think you can not prevent the warnings when using the %nrbquote function.
From the Online Doc on the %nrbquote function I read the following:
If the argument of the %NRBQUOTE function contains an unresolvable macro variable reference or macro invocation, the macro processor issues a warning message before it masks the ampersand or percent sign (assuming the SERROR or MERROR system option, described in is in effect). To suppress the message for unresolved macro variables, use the %SUPERQ function (discussed later in this section) instead.

So you may want to try the %superq function of which in the documentation is indicated:
Because %SUPERQ does not attempt any resolution of its argument, the macro processor does not issue any warning messages that a macro variable reference or a macro invocation has not been resolved. Therefore, even when the %NRBQUOTE function enables the program to work correctly, you can use the %SUPERQ function to eliminate unwanted warning messages from the SAS log.

I hope this helps. Message was edited by: eomred
deleted_user
Not applicable
There isnt any simply because %NrStr is a compile time Quoting function while %NrBQuote is a Execution time quoting function. Hence they mask certain characters at different times in the process.

%let names=%nrstr(O%'DONOVAN&O%'HARA&O%'MALLEY);
Is a compile time statement

%put WITH NRSTR Quoting Function NAMES=&names;
Is an execution time statement.

The first rule of macro quoting is 'DONT', if you think you do need it then rethink your approach. If you find you still need it make darn sure you know what you are quoting, why you are quoting it and when you want it quoted.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

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
  • 2 replies
  • 699 views
  • 0 likes
  • 2 in conversation