BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
lystyl
Calcite | Level 5

Hi,

I'm not sure if this is a bug, or if I'm not understanding how the intnx() function works with %sysfunc.

Method 1, using %sysfunc, spits out the error

"WARNING: An argument to the function INTNX referenced by the %SYSFUNC or %QSYSFUNC macro

         function is out of range.

NOTE: Mathematical operations could not be performed during %SYSFUNC function execution. The

      result of the operations have been set to a missing value."

Methods 2 and 3 output correctly within a data _null_ step.

If anyone could help enlighten me on why %sysfunc fails here, I would be really grateful.

Thanks,

Vincent

BEGIN PROGRAM

%let x=today();

/* method 1 */

%let y1=%sysfunc(intnx('qtr.2',&x,-9,'b'));

%put x=&x y1=&y1;

/* method 2 */

data _null_;

  y2=intnx('qtr.2',&x,-9,'b');

  put "y2=" y2;

run;

/* method 3*/

data _null_;

  call symput('y3', intnx('qtr.2',&x,-9,'b'));

run;

%put y3=&y3;

1 ACCEPTED SOLUTION

Accepted Solutions
stat_sas
Ammonite | Level 13

%let x=%sysfunc(today());

/* method 1 */

%let y1=%sysfunc(intnx(qtr.2,&x,-9,b));

%put x=&x y1=&y1;

View solution in original post

2 REPLIES 2
stat_sas
Ammonite | Level 13

%let x=%sysfunc(today());

/* method 1 */

%let y1=%sysfunc(intnx(qtr.2,&x,-9,b));

%put x=&x y1=&y1;

lystyl
Calcite | Level 5

Thanks for the helpful emails!

The following solution for method 1 worked, by removing all quotes, and enclosing &x with another %sysfunc() for &x.

%let y1=%sysfunc(intnx(qtr.2,%sysfunc(&x),-9,b));

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
  • 850 views
  • 0 likes
  • 2 in conversation