hello,
I have data that looks like this
data have;
input dated :date9. accid _f;
format dated date9.;
datalines;
01JAN2023 123 1
01FEB2023 123 1
01MAR2023 123 0
01APR2023 123 1
01MAY2023 123 0
;
run;
there will be 1 record per account per month and the dataset has history going back a couple of years
I need to add an additional column which states the date on which the event started (_f). for the above, the want would look like this
data have;
input dated :date9. accid _f start :date9.;
format dated date9. start date9.;
datalines;
01JAN2023 123 1 01JAN2023
01FEB2023 123 1 01JAN2023
01MAR2023 123 0 .
01APR2023 123 1 01APR2023
01MAY2023 123 0 .
;
run;
the start date would be the first time _f =1 and that should remain the same for each consecutive month where _f=1. The start date would be 'reset' when _f = 0.
Any help on how to achieve this would be very much appreciated
Thanks
... View more