DATA Step, Macro, Functions and more

how to deal with specific tokens - ' &

Reply
Contributor
Posts: 62

how to deal with specific tokens - ' &

Hello I have some specific tokens. How to deal with them. Thanks!

 

data tt;
input name $8.;
datalines;
A&M
A of M
M'M

M-M
;
run;

proc sql noprint;
select %nrbquote(name) into :n1 - :n4 from tt;
quit;

%put &n1. &n2. &n3. &n4.;

 

the log window shows nothing.

Trusted Advisor
Posts: 1,932

Re: how to deal with specific tokens - ' &

[ Edited ]

%nrbquote doesn't work on SQL or ordinary SAS variables, it only works on macro variables.

 

You want to remove %nrbquote from PROC SQL, and then use

 

%put %superq(n1) &n2 %nrbquote(&n3) %quote(&n4);
Ask a Question
Discussion stats
  • 1 reply
  • 106 views
  • 0 likes
  • 2 in conversation