Hi guys, 
suppose to have the following: 
data DB;
  input ID :$20. Admission :date09. Discharge :date09. Index; 
  format Admission date9. Discharge date9.;
cards;
0001 13JAN2015 20JAN2015 1
0001 21FEB2015 31DEC2015 0
0001 01MAR2018 30SEP2018 0
0001 01JAN2019 31DEC2019 0
0002 01JAN2015 31DEC2015 0
0002 01JAN2019 31OCT2019 0
0003 08FEB2014 10MAR2014 1
0003 16JUN2015 13JUL2015 0
0004 04MAY2016 10MAY2016 1
0004 13SEP2017 15NOV2017 1
0004 09DEC2018 31DEC2018 0
;
 
Is there a way to get the following? 
 
data DB1;
  input ID :$20. Admission :date09. Discharge :date09. Index; 
  format Admission date9. Discharge date9.;
cards;
0001 13JAN2015 20JAN2015 0
0001 21FEB2015 31DEC2015 0
0001 01MAR2018 30SEP2018 0
0001 01JAN2019 31DEC2019 0
0002 01JAN2015 31DEC2015 0
0002 01JAN2019 31OCT2019 0
0003 08FEB2014 10MAR2014 0
0003 16JUN2015 13JUL2015 0
0004 04MAY2016 10MAY2016 0
0004 13SEP2017 15NOV2017 0
0004 09DEC2018 31DEC2018 0
;
In other words, for each patient, if there is at least one 0  in the column Index (doesn't matter the date) then Index = 1 should be converted to Index = 0. 
 
Thank you in advance