Hi all,
My goal is to calculate time (days) from admission to the time a patient first received a surgical procedure, specifically, days from admission to the first "skin graft" performed for those who received this surgery. It seems straightforward, but allow me to explain this question which is actually a bit complicated.
In the NIS database, there are 25 procedure variables (PR1, PR2,..., PR25) for procedure coding (using ICD-10). And for each procedure variable, there is a corresponding variable indicating the days from admission to the time that procedure is performed (PRDAY1, PRDAY2,...,PRDAY25).
There are actually multiple ICD-10 codes for "skin graft". For example, "0HR0X73", "0HR1X73",...,"0HR7X73", and "0HR8X73" all mean "skin grafts", and they could be coded in any of the 25 procedure variables (PR1 - PR25).
We can imagine a scenario where a patient was coded "0HR0X73" in PR1 variable with "3" in the corresponding PRDAY1 variable and also coded "0HR1X73" in PR2 variable with "5" in the corresponding PRDAY2 variable. It means that this patient received a skin graft surgery on day 3 after admission and another skin graft surgery on day 5. Since my goal is to capture the time the first skin graft was performed, I would like to generate 2 variables, with one indicating that the patient received this procedure and the other one indicating it's day 3.
I am able to generate a variable indicating whether a patient received this procedure using the following codes, but I couldn't figure out a way to generate a variable indicating the time it's first performed.
gen Skingraft=0
forvalues j=1/25{
replace Skingraft=1 if inlist(PR`j', 0HR0X73", "0HR1X73",...,"0HR7X73", "0HR8X73" )
}
Thank in advance!
Related Posts with Calculate days from hospital admission to a procedure using National Inpatient Sample (NIS)
regression result only except first variableHello When I regress as below, why don't I get the result for the first variable and how can I fix …
GenerateI am using two data set, one contains data for children and another for woman. Now both data sets ha…
graph pie with some of percentagesHow to display the fraction when percentage is above 20%, I know how to display all percentages Cod…
Oaxaca decomposition for nonlinear regression (nldecompose)Hello readers, I am trying to decompose (using Ben Jann’s nldecompose) differences in the probabilit…
Year fixed effectsHello everyone, I am running a panel data regression model in which I observe 4 time periods and 66 …
Subscribe to:
Post Comments (Atom)
0 Response to Calculate days from hospital admission to a procedure using National Inpatient Sample (NIS)
Post a Comment