I currently have treatment 1/0.
I generated the following code:
Code:
///This creates yearly sum for each surgeon ID for treatment = 1 and control = 1 gen control=1 if procedure = 0 gen treatment = 1 if procedure=1 bys surgeonid year:egen yearly_treatment=sum(treatment) bys surgeonid year:egen yearly_control=sum(control)
q: Is there a way you can think of to create one variable where for each surgeon eg 12, will have the no of treatment = 1 cases per year and control = 1 cases per year
The reason is because I am using IPTW and trying to compare treatment to control
I need to weight to compare those surgeons who have treatment cases experience per year eg = 5 with those who have control cases experiences per year = 5
I tried to create a ratio of yearly_treatment/yearly_control , but this creates several options therefore taking my logistic regression using iPTW ages to run
let me know if you have any other thoughts
[/CODE]
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float(treatment_cases control_cases procedure surgeonid) str4 YEAR 1 1 1 12 "2005" 1 1 0 12 "2005" 0 1 1 1 "2006" 0 1 1 12 "2007" 1 1 1 5 "2008" 1 0 0 12 "2009" 1 0 0 6 "2010" 1 1 0 5 "2008" end
Comment