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?
If you want to get the same day in the next month, use
nextdate = intnx('month',curdate,1,'s');
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.
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).
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,
Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.
Explore Now →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.