DATA Step, Macro, Functions and more

Macro Not getting resolved

Frequent Contributor
Posts: 87

Macro Not getting resolved

I’ve a macro question. In the below code &err is resolving to mdl_rc but I want it to resolve to mdl_rc=1. Can you suggest what I’m doing wrong here?


     %let mdl_rc=1; %put &mdl_rc;


           %macro systask_err(err);

                             %put &err;

                             %if &err > 1 %then %do;

                                  %put "it resolves to &err.";

                                  data _null_; file outbox to=("")

                                  subject="&err systask failed";



                                *  endsas;



                             %else %do;

                                  data _null_; file outbox to=("")

                                  subject="&err systask success";






           *waitfor _all_ mdl;



Valued Guide
Posts: 534

Re: Macro Not getting resolved

[ Edited ]

Hi @helloSAS,


I see two ways to get what you want (if I understand you correctly):


Either call the macro this way:



or, inside the macro, use a triple ampersand in when referring to the value of mdl_rc and not its name:


%put "it resolves to &&&err.";

Hope this helps,

- Jan.

Super User
Posts: 6,785

Re: Macro Not getting resolved

Posted in reply to jklaverstijn

Using the same tools already suggested, you can get:


%put It resolves to &err=&&&err..;

Ask a Question
Discussion stats
  • 2 replies
  • 3 in conversation