Hi guys,
suppose to have the following:
data DB;
input ID :$20. Admission :date09. Discharge :date09. Morbidity1 Morbidity2 Morbidity3 Morbidity4;
format Admission date9. Discharge date9.;
cards;
0001 13JAN2017 25JAN2017 1 0 1 0
0001 13JAN2017 25JAN2017 1 0 1 0
0001 22FEB2017 03MAR2017 0 1 0 0
0001 30JAN2019 04MAR2019 1 0 0 0
0002 01DEC2018 14DEC2018 1 0 1 0
0002 25DEC2018 02JAN2019 0 0 1 0
0002 25NOV2020 03DEC2020 1 1 1 1
0003 09JAN2016 25JAN2016 0 0 1 0
0003 29JAN2018 12FEB2018 0 0 1 1
...;
Is there a way to collapse all occurencies ("1" or "0") for the same ID?
Let say the desired output should be:
data DB1;
input ID :$20. Morbidity1 Morbidity2 Morbidity3 Morbidity4;
cards;
0001 1 1 1 0
0002 1 1 1 0
0003 0 0 1 1
...;
In other words regardless the admission-discharge specificity, the occurrencies should be collapsed into one row for each ID. Values in DB for Morbidity* variables are "1" or "0". No other values are present.
Thank you in advance