I always thought that %let
creates a local
variable if used inside of %macro . . . %mend
But when I run this code , the SAS log shows 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
changed to value1
. I was expecting it to be unchanged value2
. The %let
statement inside the %macro
should have impacted ONLY the local symbol table.
When the macro processor executes a macro program statement that can create a macro variable, the macro processor creates the variable in the local symbol table if no macro variable with the same name is available to it
%let new=inventry; %macro name2; %let new=report; . .
– Ogburn