Hi Experts,
My dataset looks the following.
Start_Date CUSIP
| 27/01/2004 | 80685710 |
| 24/02/2004 | 80685710 |
| 26/08/2004 | 80685710 |
| 15/09/2004 | 80685710 |
| 23/11/2004 | 80685710 |
| 28/07/2005 | 80685710 |
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
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;
INTNX function
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;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.