I'm doing mutiple linear regressions, regressing daily stock returns on three factors. I have 1680 stocks, and for each stock, I need to conduct 57 monthly regressions. I first use the "sort" command to sort daily excess returns into month groups and then run regressions. However, when exporting the results to excel, I can only get the results for all stocks in 1 month instead of all 57 months.
How can I export the results for all stocks in all 57 months at one time? I think the problem is with the outreg2 command~
I\ve pasted part of the data below. m, s, v are the 3 independent variables, and y1 represents the daily excess return of stock i. The leftmost column is the month each excess return belongs to. I really need help! Thanks a lot!
My current commands are as follows:
forvalues i=1(1)1680{
sort B, stable
by B:reg y`i' m s v
outreg2 using 1.xls
}
How can I export the results for all stocks in all 57 months at one time? I think the problem is with the outreg2 command~
I\ve pasted part of the data below. m, s, v are the 3 independent variables, and y1 represents the daily excess return of stock i. The leftmost column is the month each excess return belongs to. I really need help! Thanks a lot!
My current commands are as follows:
forvalues i=1(1)1680{
sort B, stable
by B:reg y`i' m s v
outreg2 using 1.xls
}
m | s | v | y1 | y2 | y3 | y4 | |
2010-04 | 0.014403 | -0.00101 | -0.00035 | 0.008555 | 0.024145 | 0.00345 | 0.018391 |
2010-04 | 0.004004 | -0.00221 | -0.00269 | 0.001217 | 0.004046 | -0.00619 | -6.5E-05 |
2010-04 | 0.000375 | 0.004833 | -0.00419 | -0.00263 | -0.01747 | 0.008745 | -0.01324 |
2010-04 | -0.01927 | -0.00373 | 0.006913 | 0.001424 | -0.00264 | -0.01364 | -0.00813 |
2010-04 | -0.00967 | -0.01977 | 0.002564 | 0.01927 | 0.005089 | -0.04961 | -0.02649 |
2010-05 | -0.01115 | 0.00139 | -0.01732 | -0.0273 | -0.04494 | -0.04736 | -0.03973 |
2010-05 | 0.015091 | 0.007471 | -0.00742 | -0.00507 | 0.005303 | 0.033369 | 0.036891 |
2010-05 | -0.03947 | 0.004469 | -0.01851 | -0.07544 | -0.04145 | -0.02163 | -0.04409 |
2010-05 | -0.01899 | 0.001662 | -0.01243 | -0.00767 | 0.005505 | -0.00207 | -0.02419 |
2010-05 | -0.00292 | -0.00442 | 0.016185 | 0.009244 | 0.011015 | -0.01011 | 0.015665 |
2010-05 | -0.02382 | -0.0042 | 0.0026 | -0.05215 | -0.00692 | -0.00311 | -0.02219 |
2010-05 | -0.00563 | -0.01185 | 0.016632 | 0.036568 | 0.012348 | -0.02957 | 0.013509 |
2010-05 | 0.024402 | -0.00497 | -0.00608 | 0.031409 | 0.004021 | -6.6E-05 | 0.004398 |
Comment