Hi there.
I have a list of procedures of each patient who came to hospital.
I have grouped the data to present each hospitalID in order of admission to hospital (Date2).
I would like to find out if they developed a surgical site infection (SSI2) within 30 days of their date of procedure (date2)
hospitalid = id of patient
expected_ssi = is what i would like to see ie has the patient developed a SSI within 30 days
ssi2 = is the result i generated by using this code I wrote
gen SSI2 = 0
replace SSI2 =1 if SSI == 1 & procedureid == 1 & date2+30
The problem with this code is that it does not consider a situation where the patient did not have a procedure on the admission,
eg pt 12A admitted on 3 Dec 2020 but developed a SSI this should be coded SSI2 = 1
I have a list of procedures of each patient who came to hospital.
I have grouped the data to present each hospitalID in order of admission to hospital (Date2).
I would like to find out if they developed a surgical site infection (SSI2) within 30 days of their date of procedure (date2)
hospitalid = id of patient
expected_ssi = is what i would like to see ie has the patient developed a SSI within 30 days
ssi2 = is the result i generated by using this code I wrote
gen SSI2 = 0
replace SSI2 =1 if SSI == 1 & procedureid == 1 & date2+30
The problem with this code is that it does not consider a situation where the patient did not have a procedure on the admission,
eg pt 12A admitted on 3 Dec 2020 but developed a SSI this should be coded SSI2 = 1
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float procedureid str3 hospitalid float SSI str11 date str3 expected_ssi float(date2 SSI2) 1 "12A" 0 "1 Dec 2020" "no" 22250 0 . "12A" 1 "3 Dec 2020" "yes" 22252 0 . "13A" 0 "5 Dec 2021" "no" 22619 0 1 "13A" 0 "1 Jan 2022" "no" 22646 0 . "13A" 1 "20 Jan 2022" "yes" 22665 0 1 "14A" 1 "1 Mar 2022" "yes" 22705 1 . "14A" 0 "2 Mar 2022" "no" 22706 0 . "15A" 1 "15 Mar 2022" "yes" 22719 0 end format %td date2
Comment