I always thought that %let
creates a local
variable if used inside %macro . . . %mend
%macro . . . %mend
But when I run this code, GLOBAL TESTVAR value1
displayed in the SAS GLOBAL TESTVAR value1
%let testVar = value2; %macro test; %let testVar = value1; %mend; %test %put _all_;
So, I canβt understand why the value of the global variable testVar
has changed to value1
. I expected it to remain unchanged value2
. The %let
statement inside %macro
should ONLY reflect the local character table.
SAS Documentation :
When a macro processor executes a macro program instruction that can create a macro variable, the macro processor creates a variable in the local symbol table if a macro variable with the same name is not available for it
source share