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

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.

 

 

1 ACCEPTED SOLUTION
6 REPLIES 6
LinusH
Tourmaline | Level 20
What do you get?
Data never sleeps
renjithr
Quartz | Level 8

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:(

Shmuel
Garnet | Level 18

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()) );

data_null__
Jade | Level 19
Get rid of the quote E not 'E'
Ravikumarkummari
Quartz | Level 8

%let date=%sysfunc(intnx(month, %sysfunc(today()),-1,e), yymmdd10.);
%put &date.;

 

Just remove the single quotation markes from e

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 6 replies
  • 20255 views
  • 0 likes
  • 5 in conversation