Monday, February 23, 2009

Keep quotation in string

Have you ever needed different quotation in a string?
If it is a trouble for you, try the code below:


*Macro variable assignment;
%let str = %str(quotation %" and %'test);
%put %superq(str);

*Macro variable reference;
%let mv = %bquote(&str);
%put %superq(mv);

*Data Step;
data _null_;
str = 'quotation " and '' test';
put str=;
str = "quotation "" and ' test";
put str=;
run;

No comments: