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

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 962 views
  • 6 likes
  • 4 in conversation