Question 1:
I would like to create a variable showing the MEAN NUMBER of cases done by the surgeon at that point of having the operation
*type - is the type of the operation, revision is when the operation took place = 1.
Data:
Another question to the professionals here - Which do you think is more representative of 'experience'?
Option 1: Generate the annual number of cases for each surgeon over the total no of years in practice
bys surgeonid (yearofsurgery) :egen cumcases=total(type==1) //no of operations done over entire career
bys surgeonid (yearofsurgery) :gen annualpesvol=cumcases/yearsinpractice //avergage number of cases done per year
Option 2: Generate the number of cases per year for each surgeon.
bys surgeonid era (type) :gen annualload = _N
Option 3: Generate the number of cases 365 days up to the date of that operation
***Update I've tried this approach
However I still get 2 missing variables - I think I should assume that . = 0 ?
Or am I doing something wrong
I would like to create a variable showing the MEAN NUMBER of cases done by the surgeon at that point of having the operation
*type - is the type of the operation, revision is when the operation took place = 1.
Data:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float(type revision yearofsurgery) str1 surgeonid float(cumcases yearsinpractice annualpesvol era annualload) double type_mean 1 1 14610 "1" 2 1 2 2000 1 . 1 0 15310 "1" 2 1 2 2001 1 . 1 1 15745 "2" 3 4 .75 2003 1 . 1 0 16109 "2" 3 4 .75 2004 1 1 1 0 16468 "2" 3 4 .75 2005 1 1 1 1 17867 "2" 3 4 .75 2008 1 . 1 0 17932 "2" 3 4 .75 2009 1 1 1 1 18298 "2" 3 4 .75 2010 2 . 1 1 18303 "2" 0 10 0 2010 2 1 1 1 19029 "2" 3 4 .75 2012 1 . end format %td yearofsurgery label values type surgery label def surgery 1 "Pessary", modify
Code:
* Generate a variable to hold the mean number of PESSARYCASES over the previous 365 days at that point of having the operation yearofsurgery rangestat (mean) type, int(yearofsurgery -365 -1) by(surgeonid) **This generates missing values why is that?
Another question to the professionals here - Which do you think is more representative of 'experience'?
Option 1: Generate the annual number of cases for each surgeon over the total no of years in practice
bys surgeonid (yearofsurgery) :egen cumcases=total(type==1) //no of operations done over entire career
bys surgeonid (yearofsurgery) :gen annualpesvol=cumcases/yearsinpractice //avergage number of cases done per year
Option 2: Generate the number of cases per year for each surgeon.
bys surgeonid era (type) :gen annualload = _N
Option 3: Generate the number of cases 365 days up to the date of that operation
***Update I've tried this approach
Code:
* Generate a variable to hold the number of PESSARYCASES over the previous 365 days at that point of having the operation yearofsurgery gen date2 =mofd(yearofsurgery) format date2 %tm rangestat (mean) type, int(date2 -365 -1) by(surgeonid)
Or am I doing something wrong
Comment