BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Solly7
Pyrite | Level 9

Hi All, i have below data. So what i need to do is to add months after an each renewal. i.e if renewal date is 1-apr-2012, i need to add 12 months until i reach 1-apr-2013( i.e i need to add 1-may-2012, 1-jun-2012 till 1-april 2013).

see my below data

 

Renewal date                     Transaction type

1-april-2012                         R

1-april-2013                         R

1-april-2014                         R

1 ACCEPTED SOLUTION

Accepted Solutions
ed_sas_member
Meteorite | Level 14

Hi @Solly7 ,

 

I suggest to use the intnx() function as follows. This function applies multiples of a given interval to a date and returns the resulting value.

data want;
	set have;
	format Renewal_date2 date9.;
	do i=1 to 12;
		Renewal_date2 = intnx('month',Renewal_date,i-1);
		output;
	end;
	drop i Renewal_date;
	rename Renewal_date2 = Renewal_date;
run;

View solution in original post

2 REPLIES 2
ed_sas_member
Meteorite | Level 14

Hi @Solly7 ,

 

I suggest to use the intnx() function as follows. This function applies multiples of a given interval to a date and returns the resulting value.

data want;
	set have;
	format Renewal_date2 date9.;
	do i=1 to 12;
		Renewal_date2 = intnx('month',Renewal_date,i-1);
		output;
	end;
	drop i Renewal_date;
	rename Renewal_date2 = Renewal_date;
run;
Solly7
Pyrite | Level 9

Hi , your solutions works. thanks a lot

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 2 replies
  • 1537 views
  • 0 likes
  • 2 in conversation