BookmarkSubscribeRSS Feed
Ela_84
Fluorite | Level 6

Hi guys,

 

I need to populate a field called next instalment date and the field I'm have is current instalment date in the format date9. e.g 21Dec2019, I need to populate a field next instalment date using the current instalment date, I needs to display as 21Jan20.

 

Please can someone advice where to start?

4 REPLIES 4
Ela_84
Fluorite | Level 6

Hi Kurt,

 

this looks like it might work, I ran the statement 

 

nextdate = intnx('month',InstalmentDate,1,'s');

 

however it populates a Numeric field and not in a date format. I might be using the code incorrect. I apologies, but I'm very new and teaching myself the coding. 

Kurt_Bremser
Super User

If you create a new variable, you need to assign a date display format to make the result of the calculation human-readable. A SAS date value is a count of days from 1960-01-01, so today's date is 21935.

Add this to the code

format nextdate date9.;

and you'll get the "default" SAS date format. Others can be found in the documentation (section Date and Time).

Ela_84
Fluorite | Level 6

hi Kurt,

 

I have tried this code and it works perfect! 

 

INTNX('MONTH',InstalmentDate,+1,'SAMEDAY') AS nextdate FORMAT = Date9.

 

Thank you for great help, you lead me to this 🙂 

 

Regards,