Hi everyone, I am looking for some help comparing variable values across DONOR_ID
I have 9 variables, (turndownlogistics, turndowndonororgan, turndowndonorproblems, turndownmismatch, turndownmisc, turndownrecipientproblems, turndowndisease, turndownunknown, turndownpreservation)
these variables are the number of times an organ was turned down for that reason
For each DONOR_ID i would like to know what is the most common reason for discard
I was trying this plan:
1. bysort DONOR_ID: egen mostcommon = max(turndownlogistics, turndowndonororgan, turndowndonorproblems, turndownmismatch, turndownmisc, turndownrecipientproblems, turndowndisease, turndownunknown, turndownpreservation)
2. gen mostcommon
3. replace mostcommondiscard ="logistics" if mostcommon==turndownlogistics
replace mostcommondiscard ="donororgan" if mostcommon==turndowndonororgan
ect.
I keep getting an error that says "invalid name" when i enter the code in step 1
I was also wondering if anybody has any idea how to deal with ties in this senario?
Thank you so much
I have 9 variables, (turndownlogistics, turndowndonororgan, turndowndonorproblems, turndownmismatch, turndownmisc, turndownrecipientproblems, turndowndisease, turndownunknown, turndownpreservation)
these variables are the number of times an organ was turned down for that reason
For each DONOR_ID i would like to know what is the most common reason for discard
I was trying this plan:
1. bysort DONOR_ID: egen mostcommon = max(turndownlogistics, turndowndonororgan, turndowndonorproblems, turndownmismatch, turndownmisc, turndownrecipientproblems, turndowndisease, turndownunknown, turndownpreservation)
2. gen mostcommon
3. replace mostcommondiscard ="logistics" if mostcommon==turndownlogistics
replace mostcommondiscard ="donororgan" if mostcommon==turndowndonororgan
ect.
I keep getting an error that says "invalid name" when i enter the code in step 1
I was also wondering if anybody has any idea how to deal with ties in this senario?
Thank you so much
Comment