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

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

1 ACCEPTED SOLUTION

Accepted Solutions
stat_sas
Ammonite | Level 13

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

2 REPLIES 2
stat_sas
Ammonite | Level 13

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;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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