%SYSFUNC(INTNX(...))

Hi.
I'm trying to put the last day of July into a macro variable and I just
figured out how. The INTNX function behaves differently in the %SYSFUNC
macro function and in the DATA Step.

Examples:
%LET MinDato = %SYSFUNC( MDY(7,1,2005) );

When in the Data step the time interval must have quotes:
data _null_;
  call symput('MaxDato',intnx('month',&mindato,1)-1);
run;

But when using the %SYSFUNC macro function the interval must NOT have
quotes:
%LET MaxDato = %EVAL( %SYSFUNC( intnx(month,&mindato,1) ) -1 );

This applies to other functions with quoted arguments as well.

When using quotes in the %SYSFUNC version:
WARNING: An argument to the function INTNX referenced by the %SYSFUNC
or %QSYSFUNC macro function is out of range.

Not using quotes in the Data step version:
NOTE: Variable month is uninitialized.

Finally, I found it mentioned in the OnlineDoc:
Interfaces with the Macro Facility
Using SAS Language Functions in the DATA Step and Macro Facility
"Because %SYSFUNC is a macro function, you do not need to enclose
character values in quotation marks as you do in SAS language
functions."

Anyways, I believe the correct sentence should be "...you CANNOT
enclose character values in quotation marks...".

Similarly in the details for the %SYSFUNC() macro function:
"Because %SYSFUNC is a macro function, you do not need to enclose
character values in quotation marks as you do in DATA step functions."

Well well, not a big deal, but still confusing until you realize the
difference ;)

I guess that this is common knowledge to many of you, but after
spending some time figuring it out I though I'd document my findings.

Regards, Terje=)

0
9/7/2005 4:20:44 PM
comp.soft-sys.sas 140114 articles. 1 followers. Post Follow

1 Replies
993 Views

Similar Articles

[PageSpeed] 4

Terje,

Another thing to look at when applying formats when using sysfunc you
do not need the trailing dot like you do in a data step.

Toby Dunn

0
tobydunn (6018)
9/7/2005 4:55:39 PM
Reply: