How to double quoting a variable in a macro.

Reply
Frequent Contributor
Posts: 99

How to double quoting a variable in a macro.

%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.

Respected Advisor
Posts: 3,908

Re: How to double quoting a variable in a macro.

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?

Frequent Contributor
Posts: 99

Re: How to double quoting a variable in a macro.


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

Ask a Question
Discussion stats
  • 2 replies
  • 211 views
  • 1 like
  • 2 in conversation