I have two sets of columns PR1 to PR20 (type str12) contains procedure codes and PRDAY1 to PRDAY20 (type double) contains the day of the procedure
I need to write a code that would do to tasks.
first find the code in the PR columns, and then in PRDAY column that has the similar number (PR5 and PRDAY5) I want to calculate the mean day of the procedure and compare it between two different groups.
pr 1 pr 2 pr 3 prday3 prday3 prday3 type 1 type 2
133 111 122 2 3 4 1 0
133 155 578 2 3 4 0 1
133 111 122 7 8 9 0 1
155 111 321 2 3 4 1 0
155 555 777 2 3 4 1 0
what I want to do is, calculate the mean "day to procedure" for procedue 111 and compare it between type 1 and type 2
gen time2pr=.
forvalues j = 1/20 {
replace time2pr= sum PRDAY`j' if inlist(PR`j',"111")
}
something like that, I got stuck
I need to write a code that would do to tasks.
first find the code in the PR columns, and then in PRDAY column that has the similar number (PR5 and PRDAY5) I want to calculate the mean day of the procedure and compare it between two different groups.
pr 1 pr 2 pr 3 prday3 prday3 prday3 type 1 type 2
133 111 122 2 3 4 1 0
133 155 578 2 3 4 0 1
133 111 122 7 8 9 0 1
155 111 321 2 3 4 1 0
155 555 777 2 3 4 1 0
what I want to do is, calculate the mean "day to procedure" for procedue 111 and compare it between type 1 and type 2
gen time2pr=.
forvalues j = 1/20 {
replace time2pr= sum PRDAY`j' if inlist(PR`j',"111")
}
something like that, I got stuck
Comment