Hi guys,
suppose to have the following:
data DB;
input ID :$20. Event Index;
cards;
0001 1 0
0001 0 1
0002 1 1
0002 0 0
0003 1 0
0003 0 1
0003 0 1
0003 0 0
0003 0 1
run;
Each patient has Event = 1 corresponding to the first occurrence (there are dates). The dataset is sorted by Event. So, first.ID = 1. Then there is another column, i.e., Index, corresponding to hospitalizations at different dates (not shown). It doesn't matter if a patient has more than one hospitalization I would like to put index "1" if the patient hast at least one hospitalization. The index should be placed where Event = 1 because subsequent filters will be applied. Can anyone help me please? The desired output should be:
data DB1;
input ID :$20. Event Index;
cards;
0001 1 1
0001 0 0
0002 1 1
0002 0 0
0003 1 1
0003 0 0
0003 0 0
0003 0 0
0003 0 0
run;
Thank you in advance