I'm trying to use the macrovariable in SAS开发者_StackOverflow社区 macro as value in the newcolumn for example :
%let macrovariable = value;
I would like to have every single value in newcolumn assign as value how can do that ? I have used this code below but end up get "¯ovariable" instead of "value".
SELECT CAST('¯ovariable.' as char) newcolumn
Try using double quotes, instead of single quotes.
So.. here's the answer ( just in case anyone wants to know )
SELECT CAST(%str(%')¯ovariable.%str(%') as char) newcolumn
This way, it was actually force the macro read it with the single qotation before the pass-through sql server.
Very tricky and very fun - actually.
* Add single quotes around mv;
data _null_;
call symput('mvsq',"'&mv.'");
run;
%put &mvsq; *debug;
...
select &mvsq. ...
精彩评论