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-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!

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.

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