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,

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 1012 views
  • 0 likes
  • 2 in conversation