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
Post a Comment