Hi, I am having one problem that I could not figure out how to do this. Below is an example of the data I have: data have; input patient $ admitted_date :mmddyy10. discharge_date :mmddyy10. disposition $50.;format admitted_date discharge_date yymmdd10.; datalines; A 3/2/2020 3/15/2020 transferred to other hospital A 3/15/2020 4/2/2020 home B 5/3/2020 6/27/2020 transferred to other hospital B 6/27/2020 6/29/2020 home C 8/1/2020 8/25/2020 died D 5/15/2020 6/1/2020 transferred to other hospital D 6/1/2020 7/2/2020 home A 6/2/2020 6/25/2020 died B 8/1/2020 8/2/2020 transferred to other hospital B 8/2/2020 8/15/2020 transferred to other hospital B 8/15/2020 8/25/2020 died; Patient got to the hospital and maybe they got transferred to other hospitals because of the low bed capacity. I only want to capture them as 1 admission to the hospital (if they got transferred). However, they could get admitted again after that, their admission_count will be 2 (or even 3,4,5 times if they had to go to the hospitals again) . From the data above, I want something like this: Patient admitted date discharge_date disposition Min(admitted_date) Max(discharge_date) admission_count final_disposition A 3/2/2020 3/15/2020 transferred to other hospital 3/2/2020 4/2/2020 1 home A 3/15/2020 4/2/2020 home 3/2/2020 4/2/2020 1 home B 5/3/2020 6/27/2020 transferred to other hospital 5/3/2020 6/29/2020 1 home B 6/27/2020 6/29/2020 home 5/3/2020 6/29/2020 1 home C 8/1/2020 8/25/2020 died 8/1/2020 8/25/2020 1 died D 5/15/2020 6/1/2020 transferred to other hospital 5/15/2020 7/2/2020 1 home D 6/1/2020 7/2/2020 home 5/15/2020 7/2/2020 1 home A 6/2/2020 6/25/2020 died 6/2/2020 6/25/2020 2 died B 8/1/2020 8/2/2020 transferred to other hospital 8/1/2020 8/25/2020 2 died B 8/2/2020 8/15/2020 transferred to other hospital 8/1/2020 8/25/2020 2 died B 8/15/2020 8/25/2020 died 8/1/2020 8/25/2020 2 died Please help! I don't know how to do this 😞 Thank you so much!
... View more