I have data that is repeat patient encounters to the ER and each record has some information on comorbid conditions or missing in others. I want to create a variable that notes if a comorbidity is present in any of the records for each patient and attach it to the index record for each patient. Any advice?
Example Data:
Patient ID Comorbidity1 Comorbidity2 Comorbidity3 Visit#
1234 1 0 0 1
1234 0 0 0 2
1234 0 1 0 3
1111 0 0 0 1
1111 1 0 1 2
Ideally, I'd want a set that is only the first record for each patient, but includes whether they ever had a comorbid condition listed in any visit
Example Data:
Patient ID Comorbidity1 Comorbidity2 Comorbidity3 Visit#
1234 1 0 0 1
1234 0 0 0 2
1234 0 1 0 3
1111 0 0 0 1
1111 1 0 1 2
Ideally, I'd want a set that is only the first record for each patient, but includes whether they ever had a comorbid condition listed in any visit
Comment