Hi, I have various individuals with a unique identifier (id) in a dataset with hospitalisation records. Some individuals have multiple hospitalisations; however, because of the nature of the health system, some individuals have the same admission date (date_admit) and different discharge date (date_disch) due to billing periods/records.
There are multiple cases of this but using id 3261 as an example (dataex below), individual 3261 is hospitalised on 14jun2012 with 5 records of this with 5 different discharge dates. I would like to change this so that individual 3261’s 14jun2012 admission record is a single one with the admission date as 14june2012 and the discharge date as the latest date of 10oct2012. The aim is to do this so that the billing periods do not affect the true admission and discharge dates. I would still like to keep all the other hospital records for id 3261.
I’m attempting to use dataex for the first time in my question so I hope this is correct and helps explain my data.
I use stata 15 for reference.
Thank you in advance!
My data looks like this:
There are multiple cases of this but using id 3261 as an example (dataex below), individual 3261 is hospitalised on 14jun2012 with 5 records of this with 5 different discharge dates. I would like to change this so that individual 3261’s 14jun2012 admission record is a single one with the admission date as 14june2012 and the discharge date as the latest date of 10oct2012. The aim is to do this so that the billing periods do not affect the true admission and discharge dates. I would still like to keep all the other hospital records for id 3261.
I’m attempting to use dataex for the first time in my question so I hope this is correct and helps explain my data.
I use stata 15 for reference.
Thank you in advance!
My data looks like this:
Code:
* Example generated by -dataex-. To install: ssc install dataex
* dataex id date_admit date_disch diag_p if id==3261
clear
input long id int(date_admit date_disch) str4 diag_p
3261 19145 19158 "F29"
3261 19158 19174 "F29"
3261 19158 19205 "F29"
3261 19158 19236 "F29"
3261 19158 19266 "F29"
3261 19158 19276 "F29"
3261 20022 20026 "F29"
3261 20026 20057 "F200"
3261 20026 20060 "F200"
3261 20256 20265 "F29"
3261 20265 20275 "F200"
end
format %td date_admit
format %td date_disch
Comment