%macro name(string=);
data _null_;
name = "&string";
call symput("name",name);
run;
%put &name;
%mend;
%name (string= Vikas);
%put &name;
/*WARNING: Apparent symbolic reference NAME not resolved.*/
CALL SYMPUTX new in SAS v9 can have an extra third argument where you can specify which symbol table you want SAS to store value of this macro variable. Code below is same as above except we are using call symputx and third argument saying we want macro variable to be saved in global symbol table. So this time around we don't get the Warning message.
%macro name(string=);
data _null_;
name = "&string";
call symputx("name",name,'G');
run;
%put &name;
%mend;
%name (string= Vikas);
%put &name;
No comments:
Post a Comment