DATA Step, Macro, Functions and more

Defaulting the date to a date next month

Reply
N/A
Posts: 0

Defaulting the date to a date next month

Hi All

I need to create a new date based on todays today - so today is May, the new date should default to the 25th of June. If we are in June, the new date should default to 25th July.

I was thinking of using the :

nextMon = INTNX( 'Mon', Month(Today()), 1, 'S' );

to give me next month, but not sure how to create a value of 25Jun10

Thanks for your help.

Shelton.
Super Contributor
Super Contributor
Posts: 3,174

Re: Defaulting the date to a date next month

Posted in reply to deleted_user
You only want to specify TODAY() for 2nd argument to INTNX and use a suitable SAS DATE output format.

Scott Barry
SBBWorks, Inc.
Respected Advisor
Posts: 3,799

Re: Defaulting the date to a date next month

Posted in reply to deleted_user
You can do the same in data step if that is more appropriate for your situation.

[pre]
13 %put NextMonth25 = %sysfunc(INTNX(Mon,"25%sysfunc(Today(),monyy5.)"d,1,S),date9.);
NextMonth25 = 25JUN2010
[/pre]
Contributor
Posts: 36

Re: Defaulting the date to a date next month

Posted in reply to deleted_user
You were almost there with your code.
The 25th day of the next month is the first day + 24 days:

next_mon=intnx('month',today(),1) + 24;
Ask a Question
Discussion stats
  • 3 replies
  • 140 views
  • 0 likes
  • 4 in conversation