Hello everyone,

I am currently conducting an event study, in which I want to estimate the impact of a dividend event on trading volumes. I have 84 different companies (with more than one event per company), which all have their own trading volumes (obviously). Therefore I am struggling with how to conduct my final regression.
Short data example for only two companies with one event for each company:

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float co_id str19 security float date str8 year double(unadjusted_price adjusted_price volume) int dividend_date byte tax float(days_co estimationwindow eventwindow) double tw float lnvol
1 "1&1 DRILLISCH" 17671 "19052008"  4.64   4.64  84.2 0 . 100 1 1 1  4.433195
1 "1&1 DRILLISCH" 17672 "20052008"  4.57   4.57  81.5 0 . 101 1 1 1  4.400603
1 "1&1 DRILLISCH" 17673 "21052008"  4.53   4.53  30.6 0 . 102 1 1 1     3.421
1 "1&1 DRILLISCH" 17674 "22052008"  4.68   4.68  27.7 0 . 103 1 1 1  3.321432
1 "1&1 DRILLISCH" 17675 "23052008"  4.29   4.29  93.5 0 . 104 1 1 1 4.5379615
1 "1&1 DRILLISCH" 17678 "26052008"  4.27   4.27  61.3 0 . 105 1 1 1   4.11578
1 "1&1 DRILLISCH" 17679 "27052008"  4.47   4.47  36.5 0 . 106 1 1 1  3.597312
1 "1&1 DRILLISCH" 17680 "28052008"  4.45   4.45  19.8 0 . 107 1 1 1  2.985682
1 "1&1 DRILLISCH" 17681 "29052008"  4.46   4.46  12.7 0 . 108 1 1 1  2.541602
1 "1&1 DRILLISCH" 17682 "30052008"  4.32   4.32  34.6 0 . 109 1 1 1  3.543854
1 "1&1 DRILLISCH" 17685 "02062008"   4.4    4.4   4.3 1 1 110 1 1 1  1.458615
1 "1&1 DRILLISCH" 17686 "03062008"  4.23   4.23  70.3 0 . 111 1 1 1  4.252772
1 "1&1 DRILLISCH" 17687 "04062008"  4.26   4.26  68.3 0 . 112 1 1 1   4.22391
1 "1&1 DRILLISCH" 17688 "05062008"  4.44   4.44  41.5 0 . 113 1 1 1 3.7256935
1 "1&1 DRILLISCH" 17689 "06062008"   4.4    4.4  76.6 0 . 114 1 1 1 4.3385973
1 "1&1 DRILLISCH" 17692 "09062008"   4.3    4.3  41.5 0 . 115 1 1 1 3.7256935
1 "1&1 DRILLISCH" 17693 "10062008"  4.17   4.17  72.9 0 . 116 1 1 1 4.2890887
1 "1&1 DRILLISCH" 17694 "11062008"  4.05   4.05  72.9 0 . 117 1 1 1 4.2890887
1 "1&1 DRILLISCH" 17695 "12062008"  4.08   4.08  23.5 0 . 118 1 1 1     3.157
1 "1&1 DRILLISCH" 17696 "13062008"  4.16   4.16   127 0 . 119 1 1 1  4.844187
1 "1&1 DRILLISCH" 17699 "16062008"  4.15   4.15    30 0 . 120 1 1 1 3.4011974
2 "AAREAL BANK"   17671 "19052008" 22.25 20.023 357.2 0 . 100 1 1 1  5.878296
2 "AAREAL BANK"   17672 "20052008"  21.6 19.438 635.6 0 . 101 1 1 1  6.454569
2 "AAREAL BANK"   17673 "21052008" 21.42 19.276 426.4 0 . 102 1 1 1  6.055378
2 "AAREAL BANK"   17674 "22052008" 20.94 18.845 236.3 1 1 103 1 1 1  5.465102
2 "AAREAL BANK"   17675 "23052008" 20.01 18.008 647.9 0 . 104 1 1 1  6.473736
2 "AAREAL BANK"   17678 "26052008"  19.9 17.909 138.2 0 . 105 1 1 1  4.928702
2 "AAREAL BANK"   17679 "27052008" 19.35 17.414 461.2 0 . 106 1 1 1  6.133832
2 "AAREAL BANK"   17680 "28052008" 19.37 17.432 255.5 0 . 107 1 1 1  5.543222
2 "AAREAL BANK"   17681 "29052008" 19.08 17.171 381.8 0 . 108 1 1 1  5.944897
2 "AAREAL BANK"   17682 "30052008" 19.13 17.216 318.8 0 . 109 1 1 1  5.764564
2 "AAREAL BANK"   17685 "02062008" 18.77 16.892 287.1 0 . 110 1 1 1  5.659831
2 "AAREAL BANK"   17686 "03062008" 18.92 17.027 164.8 0 . 111 1 1 1  5.104733
2 "AAREAL BANK"   17687 "04062008" 18.82 16.937 224.3 0 . 112 1 1 1  5.412984
2 "AAREAL BANK"   17688 "05062008" 19.01 17.108 306.7 0 . 113 1 1 1   5.72587
2 "AAREAL BANK"   17689 "06062008" 18.87 16.982 331.4 0 . 114 1 0 1  5.803326
2 "AAREAL BANK"   17692 "09062008" 18.46 16.613   421 0 . 115 1 0 1  6.042633
2 "AAREAL BANK"   17693 "10062008" 18.18 16.361 194.8 0 . 116 1 0 1  5.271974
2 "AAREAL BANK"   17694 "11062008" 17.59  15.83 318.2 0 . 117 1 0 1   5.76268
2 "AAREAL BANK"   17695 "12062008" 17.42 15.677 807.8 0 . 118 1 0 1  6.694314
2 "AAREAL BANK"   17696 "13062008" 17.61 15.848 331.3 0 . 119 1 0 1  5.803024
2 "AAREAL BANK"   17699 "16062008" 17.72 15.947   221 0 . 120 1 0 1  5.398163
end
format %td date
I think I have to regress my variables for each company individually with a command like forvalues. Otherwise Stata would take all trading volumes as a time series of volumes, as it would do it for one company only (I think).


Code:
sort co_id
summ co_id
local total_co = `r(max)'
      
forvalues i = 1/`total_co' {

      xtmixed lnvol dividend_date eventwindow tw if co_id == `i' & estimationwindow==1

      }
(The regression is adjusted to the small data example)

However, this command will result in 84 outputs (two in the data example), one for each company. My question is how to average these outputs into one output? Or if there is a command which accounts for each company individually but delivers just one average output.

Thank you very much in advance for your help!