Home › Forums › Main Forums › SAS Forum › A key difference when creating a macro variable by Call Symput and Proc SQL
-
A key difference when creating a macro variable by Call Symput and Proc SQL
-
Interview question:
Please give 3 differences between between Call Symput and Select Into when you use them to create macro variables.There exist several distinct differences between Call Symput and Select Into when you use them to create macro variables. Below is one of them. Run below code:
data H;
A= 18965;
format A date9.;
call symput( "MA", A);
run;
%put MA=*&MA*;
proc sql;
select A into: SMA
from H;
quit;
%put MA=*&SMA*;The SAS output is:
%put MA=*&MA*; MA=* 18965*
%put SMA=*&SMA*; SMA=*04DEC2011*So, when we use format, the 2 macro variables created by Call Symput and SQL have different values. Call Symput assigns the numeric value of A—
18965— to the created macro variable, while the Proc SQL assigns the formatted value—- 04DEC2011— to the generated macro variable. You got it?- This discussion was modified 3 years, 10 months ago by Datura.
Log in to reply.