Search code examples
sassas-macro

SAS store macro reference in macro variable


I want to store a list of macro references in another macro variable and then change the content of one of the referenced variables.

As example:

%LET String=FirstString; 
%LET KeepMacroNotString=&String; 
%PUT &String = &KeepMacroNotString ?;  


%LET String=String changed; 
%PUT &String = &KeepMacroNotString?; 

In the end I would like that %PUT &KeepMacroNotString resolves to "String changed". However it sticks to the first assignment.

Any ideas? Thx, Lubenja


Solution

  • Much easier to do with a data step.

    data _null_;
      call symputx('KeepMacroNotString','&String');
    run;