I do have the following data in SAS. The variable strdat shows some values such as 99979797 for the second or higher order observations for the same id. I want to replaced these observations using the variable enddat from the previous observations + 7 days. For example, for id=2, the second observation strdat must change to 20050808.
Original Data
data data_b;
input id obs strdat enddat
;
datalines;
1 1 20061130 20081215
2 2 99979797 20070905
2 1 20010215 20050801
3 3 20100115 20101231
3 2 20060203 20070601
3 1 20041115 20050202
4 3 99979797 20101231
4 2 20060101 20060205
4 1 20050810 20051010
5 1 20041201 20050614
5 2 20060105 20060301
5 3 20061015 20090606
run;
Desired Output
1 1 20061130 20081215
2 2 20050808 20070905
2 1 20010215 20050801
3 3 20100115 20101231
3 2 20060203 20070601
3 1 20041115 20050202
4 3 20060212 20101231
4 2 20060101 20060205
4 1 20050810 20051010
5 1 20041201 20050614
5 2 20060105 20060301
5 3 20061015 20090606