sas - What's wrong with these macro parameters? -


i have following simplified version of piece of code working on:

%macro test(var);  %if &var = 'sub prime' %then %do; %let var2 = 'sub_prime'; %put &var2; %end; %mend;  %test(sub%str( )prime); 

basically point of if var = 'sub prime' var2 should = 'sub_prime'. appears though var not equal 'sub prime'. can tell me doing wrong?

thanks

macro variables not use quotations.

%macro test(var);  %if &var = %str(sub prime) %then %do;   %let var2 = sub_prime;   %put &=var2; %end; %mend;  %test(sub%str( )prime); 

you'd better off using %str around whole thing, though, rather inserting %str in space.

%test(%str(sub prime)); 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -