macro function question

Accepted Solution Solved
Reply
Contributor
Posts: 36
Accepted Solution

macro function question

Hi,

I have following code.

%let m = 0;

%let cal_month = %eval(intnx('month', &min_monthdate, &m));

SAS gave me an error message of

ERROR: Required operator not found in expression: intnx('month',        15096, 0)

How should I fix it? Thank you.


Accepted Solutions
Solution
‎08-13-2014 01:44 PM
Respected Advisor
Posts: 4,962

Re: macro function question

Macro language does not understand how to use INTNX.  You can force it to understand by adding %SYSFUNC.  In that case the quotes around 'month' disappear (macro language assumes that month is a character string and not a reference to a variable).  And there is no need for %EVAL since INTNX returns an integer.

%let cal_month = %sysfunc(intnx(month, &min_monthdate, &m));

View solution in original post


All Replies
Trusted Advisor
Posts: 1,203

Re: macro function question

let cal_month = %eval(intnx('month', "&min_monthdate"d, &m));

Contributor
Posts: 36

Re: macro function question

Thank you for the reply, but I got the same error.

ERROR: Required operator not found in expression: intnx('month', "       15096"d, 0)

Solution
‎08-13-2014 01:44 PM
Respected Advisor
Posts: 4,962

Re: macro function question

Macro language does not understand how to use INTNX.  You can force it to understand by adding %SYSFUNC.  In that case the quotes around 'month' disappear (macro language assumes that month is a character string and not a reference to a variable).  And there is no need for %EVAL since INTNX returns an integer.

%let cal_month = %sysfunc(intnx(month, &min_monthdate, &m));

Contributor
Posts: 36

Re: macro function question

Thank you so much! It works!

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 231 views
  • 1 like
  • 3 in conversation