Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

incrementing SAS years and months

Status
Not open for further replies.

burndengreen

Programmer
Jan 28, 2004
6
0
0
GB
I have a number of products all of which have a start date they then have an indicator which shows the interval factor for its end date 1 = years 2 = months and a further field which indicates how many years / months. So for example start date 08dec2004 interval factor 1 interval period 7. This means i want to calculate a date seven years from now to the day. i have used intnx which because of the interval gives me 01jan2011 which is no good as i want to increment the year only. In SQL dateadd would work but there seems to be no similar function in SAS. I will have a similar problem when the interval factor is 2 (increment by months) i.e. add 26 months to todays date.
Any help gratefully received.

 
Seems like i worked it out myself.

currend = MDY(Month(currstrt), Day(currstrt), Year(currstrt) + termintv);


where currstrt is the start point and termintv contains a numeric value to increase the year portion of currstrt.
 
Yep, that'll do it. Unfortunately I can't think of an easier way to do it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top