Good morning,

I have a dataset of companies (ik), case-number, year, procedure-type and quintiles.
Now I'd like to calculate the Mean annual company procedure volume per quintile

Therefore i created the variable casesperik, which gives me the case number per company.

Now I've tried to use a Code to calculate the median cases per year by quintile like this one in several ways, but I wasn't successful

Code:
 tabstat ####, stat (N mean sd) by(quintile)
I would be very thankful for some help!!
ik case-number year quintile casesperik procedure-typ
260100023 11649082 2013 1 1 2
260100034 14198663 2012 4 3 3
260100034 6420693 2013 4 4
260100034 12981605 2015 4 4
260100147 999779 2015 4 3 3
260100147 2289626 2014 4 2
260100147 10504606 2014 4 2
260100432 7756966 2013 3 2 4
260100432 6988745 2014 3 3
260100454 18313122 2014 1 1 2
260100476 17306808 2015 1 1 2
260100739 18212972 2013 5 5 32
260100739 16884461 2010 5 4
260100739 19672375 2012 5 4
260100739 15432329 2011 5 2
260100739 47064384 2009 5 1
260100820 3746991 2015 1 1 3
260100875 21989008 2011 4 4 43
260100875 41335174 2009 4 7
260100875 9591743 2013 4 6
260100875 10806055 2012 4 6
260100911 20853059 2012 1 1 4
260101126 13001086 2014 1 1 7
260101137 19718069 2014 3 2 4
260101137 22636978 2010 3 8
260101193 18595578 2015 1 1 9
260101809 16938712 2010 1 1 1
260101865 16206583 2013 1 1 3
260102036 18510223 2010 1 1 4
260102081 19520974 2014 1 1 5
260102343 7826502 2014 3 2 1
260102343 23254003 2012 3 7
260102354 3064907 2011 4 3 8
260102354 15012738 2015 4 2
260102354 23028509 2011 4 9
260102423 426848 2012 1 1 22
260102434 23818021 2014 3 2 8
260102434 9718763 2011 3 5
260200013 18148532 2012 5 10 6
260200013 43751584 2009 5 7
260200013 15677131 2011 5 34
260200013 15104951 2012 5 9
260200013 13361926 2011 5 8
260200013 18020290 2014 5 8
260200013 15793788 2012 5 9
260200013 12914825 2009 5 8
260200013 23123201 2013 5 8
260200013 15734117 2011 5 9
260200035 11812412 2013 5 5 1