Changing Year

Accepted Solution Solved
Reply
Regular Contributor
Posts: 183
Accepted Solution

Changing Year

Hi Experts,

My dataset looks the following.

Start_Date    CUSIP

27/01/200480685710
24/02/200480685710
26/08/200480685710
15/09/200480685710
23/11/200480685710
28/07/200580685710

I want the output like the following that means I want to add a column where one year will be added to the Start_Date to get the End_Date:

Start_Date    CUSIP         End_Date

27/01/2004   80685710     27/01/2005

...

...

28/07/2005  80685710       28/07/2006


Accepted Solutions
Solution
‎04-19-2015 01:30 PM
Trusted Advisor
Posts: 1,203

Re: Changing Year

data have;

input Start_Date :anydtdte. CUSIP;

format Start_Date End_date ddmmyy10.;

End_date=intnx('year',start_Date,1,'S');

datalines;

27/01/2004 80685710

24/02/2004 80685710

26/08/2004 80685710

15/09/2004 80685710

23/11/2004 80685710

28/07/2005 80685710

;

proc print data=have;

run;

View solution in original post


All Replies
Grand Advisor
Posts: 17,325

Re: Changing Year

Solution
‎04-19-2015 01:30 PM
Trusted Advisor
Posts: 1,203

Re: Changing Year

data have;

input Start_Date :anydtdte. CUSIP;

format Start_Date End_date ddmmyy10.;

End_date=intnx('year',start_Date,1,'S');

datalines;

27/01/2004 80685710

24/02/2004 80685710

26/08/2004 80685710

15/09/2004 80685710

23/11/2004 80685710

28/07/2005 80685710

;

proc print data=have;

run;

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 178 views
  • 3 likes
  • 3 in conversation