When i run the below Code :

%Let X=100;

%macro test;

proc sql;
select * from sashelp.class;
Quit;

data one;
call symput('X',200);
run;

%put _user_;

%mend test;

%test

I get the following output in the log :

GLOBAL X 200

I had expected the ouput to be as follows :

TEST X 200
GLOBAL X 100

Can you please let me know why this is so? I was assuming that according to the special case of CALL SYMPUT ie when it is used after a PROC SQL within a macro the macro variable is created in the LOCAL SYMBOL table and that is what should be observed above. But as you see above it is not so.