Hello everyone,
Why if I use (5 or 6 )to replace (3 and 4) will NOT get 'a' in the SAS log?
Thanks!
Mike
/*1.*/%let g=2;
/*2.*/%let cc3=a;
/*3.*/%let k= %eval(&g+1);
/*4. */%put &&cc&k;
/*5.*/%put &&cc%eval(&g+1);
/*6.*/%put &cc%eval(&g+1);
cause '&' resolves before %eval computation.
&&cc%eval(&g+1) -> &cc%eval(2+1) -> 'warning: cc not resolved' ->&cc3
Haikuo
The %eval is just going to concatenated to the resolution of the macro variable &&cc or &cc. Compound macro variable resolution is not available in that syntax.
http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a001071915.htm
%let g=2;
%let cc3=a;
%put %unquote(%nrstr(&cc)%eval(&g + 1));
awesome!
Thank you!
Hi Mike,
You might also use the following alternative:
%put %superq(cc%eval(&g+1));
Regards,
Florent
That is fantastic!
Thanks!
Mike
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 the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.