Dear All-
I am trying to create a new variable ('reference_median') populated with the median value of the number of staff (var: 'fte') for each level of health care worker (var: 'cadre_cat'), type of support (var: 'support_type'), and clinic size category (var: cop18tier). I understand that this is some combination of a bysort command along the lines of: bysort cadre_cat support_type (cop18tier): egen ref_fte=median(fte).
The other wrinkle is that I want to populate all of the other quartiles (var: quartile_txcurr) with the median values that I get for quartile_txcurr=4 (quartile 4 is the best performing quartile and I want to use their median number of staff as a reference for the other quartiles).
I can't seem to get the right combination---I have attached a sub-set of my dataset here.
I would very much appreciate any quick help/guidance anyone may have.
Best-Patrick
I am trying to create a new variable ('reference_median') populated with the median value of the number of staff (var: 'fte') for each level of health care worker (var: 'cadre_cat'), type of support (var: 'support_type'), and clinic size category (var: cop18tier). I understand that this is some combination of a bysort command along the lines of: bysort cadre_cat support_type (cop18tier): egen ref_fte=median(fte).
The other wrinkle is that I want to populate all of the other quartiles (var: quartile_txcurr) with the median values that I get for quartile_txcurr=4 (quartile 4 is the best performing quartile and I want to use their median number of staff as a reference for the other quartiles).
I can't seem to get the right combination---I have attached a sub-set of my dataset here.
I would very much appreciate any quick help/guidance anyone may have.
Best-Patrick
Comment