Dear All,
I am struggling with my research. I have a panel data sets with roughly 15.000 companies with 25 years of monthly returns. I want to run a the following regression for each company sperately:
After this regression, i want to store the constant of each regression. So I can rank the companies based on this constant.
I already tried the following code, but it was not working
Where did i made the mistake?
here also an example of my dataset.
I am struggling with my research. I have a panel data sets with roughly 15.000 companies with 25 years of monthly returns. I want to run a the following regression for each company sperately:
Code:
reg excess MktRF SMB HML RMW CMA RF
I already tried the following code, but it was not working
Code:
tempname myresult quietly foreach `v' in idd{ reg excess MktRF SMB HML RMW CMA RF post `myresult' (`x') (`= _b[_cons]' } postclose `myresult' use myresult
here also an example of my dataset.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float monthly long idd double(MktRF SMB HML RMW CMA) float excess 388 16831 . . . . . . 388 6358 . . . . . . 388 5798 . . . . . . 388 10420 . . . . . . 388 974 . . . . . . 388 11030 . . . . . . 388 7823 . . . . . . 388 6456 . . . . . . 388 4740 . . . . . . 388 4547 . . . . . . 388 13377 . . . . . . 388 12668 . . . . . . 388 14502 . . . . . . 388 6757 . . . . . . 388 506 . . . . . . 388 10117 . . . . . . 388 6295 . . . . . . 388 13727 . . . . . . 388 1837 . . . . . . 388 5953 . . . . . . 388 3501 . . . . . . 388 6783 . . . . . . 388 4089 . . . . . . 388 7899 . . . . . . 388 7142 . . . . . . 388 9471 . . . . . . 388 7993 . . . . . . 388 2652 . . . . . . 388 5082 . . . . . . 388 10705 . . . . . . 388 8508 . . . . . . 388 6474 . . . . . . 388 5426 . . . . . . 388 5788 . . . . . . 388 11116 . . . . . . 388 17365 . . . . . . 388 3921 . . . . . . 388 16109 . . . . . . 388 4276 . . . . . . 388 4319 . . . . . . 388 14529 . . . . . . 388 16723 . . . . . . 388 5802 . . . . . . 388 509 . . . . . . 388 16511 . . . . . . 388 14195 . . . . . . 388 7277 . . . . . . 388 202 . . . . . . 388 15575 . . . . . . 388 12296 . . . . . . 388 1820 . . . . . . 388 6178 . . . . . . 388 1481 . . . . . . 388 7713 . . . . . . 388 15797 . . . . . . 388 14239 . . . . . . 388 11611 . . . . . . 388 13748 . . . . . . 388 6054 . . . . . . 388 11546 . . . . . . 388 10356 . . . . . . 388 3768 . . . . . . 388 4353 . . . . . . 388 3444 . . . . . . 388 7173 . . . . . . 388 16650 . . . . . . 388 15824 . . . . . . 388 7180 . . . . . . 388 1273 . . . . . . 388 6487 . . . . . . 388 11565 . . . . . . 388 6120 . . . . . . 388 14252 . . . . . . 388 12766 . . . . . . 388 14958 . . . . . . 388 3072 . . . . . . 388 4733 . . . . . . 388 12910 . . . . . . 388 16847 . . . . . . 388 847 . . . . . . 388 4472 . . . . . . 388 17485 . . . . . . 388 5269 . . . . . . 388 4054 . . . . . . 388 2694 . . . . . . 388 5487 . . . . . . 388 12212 . . . . . . 388 1479 . . . . . . 388 8890 . . . . . . 388 5172 . . . . . . 388 848 . . . . . . 388 17650 . . . . . . 388 7773 . . . . . . 388 11586 . . . . . . 388 1348 . . . . . . 388 6942 . . . . . . 388 9786 . . . . . . 388 4708 . . . . . . 388 510 . . . . . . 388 13210 . . . . . . end format %tm monthly label values idd idd label def idd 202 "AT0000675657(P)", modify label def idd 506 "AT0000764741(P)", modify label def idd 509 "AT0000764774(P)", modify label def idd 510 "AT0000764782(P)", modify label def idd 847 "AT0000A08LF4(P)", modify label def idd 848 "AT0000A08S86(P)", modify label def idd 974 "AT0000A0J8T8(P)", modify label def idd 1273 "BE0167676601(P)", modify label def idd 1348 "BE0172712524(P)", modify label def idd 1479 "BE0944721381(P)", modify label def idd 1481 "BE0944803239(P)", modify label def idd 1820 "BE6217705050(P)", modify label def idd 1837 "BE6224091866(P)", modify label def idd 2652 "CH0034886173(P)", modify label def idd 2694 "CH0039208126(P)", modify label def idd 3072 "CH0180953181(P)", modify label def idd 3444 "DE0005324388(P)", modify label def idd 3501 "DE0008471715(P)", modify label def idd 3768 "DE0009779546(P)", modify label def idd 3921 "DE000A0ES8W6(P)", modify label def idd 4054 "DE000A0NAUK8(P)", modify label def idd 4089 "DE000A0RCCX6(P)", modify label def idd 4276 "DK0010260629(P)", modify label def idd 4319 "DK0010310077(P)", modify label def idd 4353 "DK0016208515(P)", modify label def idd 4472 "DK0060244408(P)", modify label def idd 4547 "EE3600095295(P)", modify label def idd 4708 "ES0114812037(P)", modify label def idd 4733 "ES0115324032(P)", modify label def idd 4740 "ES0115352033(P)", modify label def idd 5082 "ES0164467005(P)", modify label def idd 5172 "ES0175174038(P)", modify label def idd 5269 "FI0008801592(P)", modify label def idd 5426 "FI0008807086(P)", modify label def idd 5487 "FI0008808761(P)", modify label def idd 5788 "FR0000003188(P)", modify label def idd 5798 "FR0000008674(P)", modify label def idd 5802 "FR0000010993(P)", modify label def idd 5953 "FR0000288086(P)", modify label def idd 6054 "FR0000430639(P)", modify label def idd 6120 "FR0000442329(P)", modify label def idd 6178 "FR0000447633(P)", modify label def idd 6295 "FR0000974933(P)", modify label def idd 6358 "FR0000982209(P)", modify label def idd 6456 "FR0000989022(P)", modify label def idd 6474 "FR0000990608(P)", modify label def idd 6487 "FR0000991754(P)", modify label def idd 6757 "FR0007046065(P)", modify label def idd 6783 "FR0007050232(P)", modify label def idd 6942 "FR0007080395(P)", modify label def idd 7142 "FR0007497656(P)", modify label def idd 7173 "FR0010013987(P)", modify label def idd 7180 "FR0010018192(P)", modify label def idd 7277 "FR0010077818(P)", modify label def idd 7713 "FR0010285874(P)", modify label def idd 7773 "FR0010311993(P)", modify label def idd 7823 "FR0010339481(P)", modify label def idd 7899 "FR0010377549(P)", modify label def idd 7993 "FR0010449231(P)", modify label def idd 8508 "FR0010668145(P)", modify label def idd 8890 "FR0010929703(P)", modify label def idd 9471 "FR0011759299(P)", modify label def idd 9786 "GB0002050432(P)", modify label def idd 10117 "GB0005627822(P)", modify label def idd 10356 "GB0007434136(P)", modify label def idd 10420 "GB0007677031(P)", modify label def idd 10705 "GB0030285372(P)", modify label def idd 11030 "GB0031560294(P)", modify label def idd 11116 "GB0031811739(P)", modify label def idd 11546 "GB0033589226(P)", modify label def idd 11565 "GB0033702944(P)", modify label def idd 11586 "GB0033737874(P)", modify label def idd 11611 "GB0033882860(P)", modify label def idd 12212 "GB00B0T50V66(P)", modify label def idd 12296 "GB00B119QQ08(P)", modify label def idd 12668 "GB00B1VKSD43(P)", modify label def idd 12766 "GB00B1XMSK57(P)", modify label def idd 12910 "GB00B24CSW38(P)", modify label def idd 13210 "GB00B39RN144(P)", modify label def idd 13377 "GB00B3KD9Q85(P)", modify label def idd 13727 "GB00B4NVLL51(P)", modify label def idd 13748 "GB00B4Q8LG85(P)", modify label def idd 14195 "GB00B6236B14(P)", modify label def idd 14239 "GB00B6449M48(P)", modify label def idd 14252 "GB00B64TSD33(P)", modify label def idd 14502 "GB00B74YXH41(P)", modify label def idd 14529 "GB00B76N7B10(P)", modify label def idd 14958 "GB00B8440Z89(P)", modify label def idd 15575 "GB00BCZNXX14(P)", modify label def idd 15797 "GB00BJ04HP86(P)", modify label def idd 15824 "GB00BJ0KH452(P)", modify label def idd 16109 "HU0000708805(P)", modify label def idd 16511 "IT0004380314(P)", modify label def idd 16650 "LI0015977106(P)", modify label def idd 16723 "LI0029404063(P)", modify label def idd 16831 "LI0126894554(P)", modify label def idd 16847 "LI0138754903(P)", modify label def idd 17365 "NO0010325715(P)", modify label def idd 17485 "PLPPTFI00147(P)", modify label def idd 17650 "SE0000569667(P)", modify
Comment