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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -