Both responders above have hit the nail on the head. As your if condition is false, the call symput code is never run and thus your code never initializes the new macro variable macro_var1. Without initializing, it is an unknown macro variable when the put statement is run. When this occurs, the put statement simply outputs the unknown macro variable name. This can be quickly solved by first initializing the macro variable: %let macro_var1=; data _null_; set info1; if compress(upcase(a),'','cops') eq 'abc' then call symputx('macro_var1',b,'g'); /*if condition evaluates to false*/ run; %put Macro var1 is: ¯o_var1; Or by setting the variable with another symput statement when the condition is true. data _null_; set info1; if compress(upcase(a),'','cops') eq 'abc' then call symputx('macro_var1',b,'g'); /*if condition evaluates to false*/ else call symputx('macro_var1','new value','g'); /*if condition evaluates to true*/ run; %put Macro var1 is: ¯o_var1; In either case, the macro variable will always be a known variable.
... View more