Hi,
I am trying to get the end of previoius month using this macro, but guess I am missing something.
%let date=%sysfunc(intnx(month, %sysfunc(today()),-1,'e'), yymmdd10.);
%put &date.;
Please help.
Thank you!
I get the below message:
67 %let date=%sysfunc(intnx(month, %sysfunc(today()),-1,'e'), yymmdd10.);
WARNING: Argument 4 to 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.
68 %put &date.;
Not sure what I need to do or missing:(
Without %sysfunc you can calculate date with data step inside the macro program, just as:
data _NULL_;
date = today() - day(today());
call symput('date', left(date));
run;
with %sysfunc,you can try:
%let date = %sysfunc( today() - day(today()) );
Thank you!
%let date=%sysfunc(intnx(month, %sysfunc(today()),-1,e), yymmdd10.);
%put &date.;
Just remove the single quotation markes from e
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.
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.