Hi,
put me on to this new feature in SAS 9.3 via a LinkedIn post.
From the 9.3 SAS doc (see Tip for the %PUT statement):
%let x=1;
%put &=x;
However, can anyone (a little birdie perhaps?) say why this doesn't work?
%let y1=2;
%let i=1;
%put Y&i=&&y&i; * works ;
%put &=y1; * works ;
%put &=y&i; * does not work ;
or my more realistic example (from a macro I'm writing):
%let z1=A;
%let z2=B;
%let z3=C;
%macro test;
%do i=1 %to 3;
%put Z&i=&&z&i; * works ;
%put &=z&i; * does not work ;
%end;
%mend;
%test;
Otherwise, consider this a minor bug report and/or enhancement request.
I think its a "feature".
The doco says: "If you place an equal sign between the ampersand and the macro variable name of a ** direct ** macro variable reference, the macro variable's name displays in the log along with the macro variable's value.
It would be good to be able to an indirect reference though.
Hi Scott & Jerry,
Yes it does appear to be a feature for only "direct" macros. Thought I'd reference the documentation page as well (look for the Tip), http://support.sas.com/documentation/cdl/en/mcrolref/64754/HTML/default/viewer.htm#n189qvy83pmkt6n1b...
Cheers,
Michelle
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: