Hi,
Thanks In advance
I need to calculate the end_date using start date.
The date columns is in date format.
I want to calculate the end_date on basis of id and term_month_begin and term_month_end.
Pease help me to get data correctly
input dataset
------------------------
id Term_month_begin Term_Month_end Start_dt
1 6 6 2011-01-04
1 12 12 2011-01-04
2 3 3 2011-01-04
2 3 3 2016-02-04
2 6 6 2017-02-03
2 6 6 2018-02-01
output I want
------------------
id Term_month_begin Term_Month_end Start_dt end_dt
1 6 6 2011-01-04 9999-99-99
1 12 12 2011-01-04 9999-99-99
2 3 3 2011-01-04 2016-02-03
2 3 3 2016-02-04 9999-99-99
2 6 6 2017-02-03 2017-12-31
2 6 6 2018-02-01 9999-99-99
1) A date like '9999-99-99' is not a valid date. You can either assign value as '9999-12-31' or keep a separate variable for indication (1 or 0);
2) It is not clear when the end_dt should be assigned as '9999-99-99' and when to skip to next following observation(s) or how and when to compute the end_dt.
But you haven't explained how to determine when you want 9999-99-99.
You also haven't explained how to compute END_DT when it is not 9999-99-99.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.