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

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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