BookmarkSubscribeRSS Feed
Mike_Davis
Fluorite | Level 6

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);

5 REPLIES 5
Haikuo
Onyx | Level 15

cause '&' resolves before %eval computation.

&&cc%eval(&g+1) -> &cc%eval(2+1) -> 'warning: cc not resolved' ->&cc3

Haikuo

FriedEgg
SAS Employee

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));

Mike_Davis
Fluorite | Level 6

awesome!

Thank you!

Florent
Quartz | Level 8

Hi Mike,

You might also use the following alternative:


     %put %superq(cc%eval(&g+1));

Regards,

Florent

Mike_Davis
Fluorite | Level 6


That is fantastic!

Thanks!

Mike

sas-innovate-2024.png

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.

 

Register now!

What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 860 views
  • 6 likes
  • 4 in conversation