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
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.