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
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 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.