BookmarkSubscribeRSS Feed
bbb_NG
Fluorite | Level 6

%LET IN1=(sum(sumliab,-sumliabp)>0 AND sum(sumliab,-sumliabp)<100000);

%inoutflow(wu1.custbase2m,work.T8_1a,'N',SA,sap,'IN1');

%macro inoutflow(dsin,dsout,ntb,product,pro1,custclass);

...

...

where 'New Cust Ind'n=&ntb AND 'Ver Date'n = &curdate AND  SUM (&product,-&pro1) >=0.01 and &&custclass;

...

%mend

in this macro ,the last input variable is for custclass,

and it has been declared in %let

but this quoting &&custclass is not my intention.

my intention is this &&custclass=(sum(sumliab,-sumliabp)>0 AND sum(sumliab,-sumliabp)<100000);(ln let statement equals value for IN1)

thanks.

2 REPLIES 2
Patrick
Opal | Level 21

From what you posted I believe what you need to do is:

-  define the macro before you call it!

     %inoutflow must come AFTER %macro inoutflow;.... %mend;

- %inoutflow(wu1.custbase2m,work.T8_1a,'N',SA,sap,&IN1);

   Don't use quotes. This way the macro variable resolves and the macro value is passed as parameter to the macro call.

- ...,-&pro1) >=0.01 and &custclass

       Only one '&' is needed as the macro variable already contains the resolved value from &IN

Else: You would have to pass &IN1 to the macro call in a way that it doesn't get resolved -> %nrstr(&in1)  .... but why would you do that?

bbb_NG
Fluorite | Level 6


Patrick,

     It solved my problem.Very thanks. And sorry to put macro-using before defining.

what's worse, I can find "correct answer" click near your discussion.

Dawn

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 2 replies
  • 1104 views
  • 1 like
  • 2 in conversation