Hi,
I am dealing with missing values when using asreg. I have read Attaullah Shah's explanation of the package but I still don't know where I'm messing up.
Goal:
My aim is to calculate abnormal cash flows from operation (CFO). In order to do so I must first run a regression on CFO of each industry-year. Then I subtract those coefficients from the actual CFO for every firm.
Stata:
Run a cross-sectional regression for each industry-year and save the coefficients.
I run the following commands
bys sic : asreg CFO scassets scsales scdsales, robust window(year 5)
list year _b_cons _b_scassets _b_scsales _b_scdsales in 1/25
Problem:
My issue is the following: whenever I run the command I get missing values in certain years.
These are the results I get from the asreg command (I'm sorry I don't know how to show this with dataex)
. list year _b_cons _b_scassets _b_scsales _b_scdsales in 1/25
+----------------------------------------------------------+
| year _b_cons _b_scass~s _b_scsales _b_scdsa~s |
|----------------------------------------------------------|
1. | 2007 . . . . |
2. | 2013 -.04137871 -1454.5413 .26266831 -.35338505 |
3. | 2012 -.38693713 3034.2662 .21646971 -.27079479 |
4. | 2010 -.85324587 -8938.4823 1.6439263 -.12898214 |
5. | 2006 . . . . |
|----------------------------------------------------------|
6. | 2011 -.16358315 -12266.271 1.2316633 -.93329911 |
7. | 2015 -.02253046 -724.27971 .16337456 -.08283015 |
8. | 2008 . . . . |
9. | 2009 . . . . |
10. | 2016 .01235643 950.81255 .01738386 .02459045 |
|----------------------------------------------------------|
11. | 2014 .00971925 449.31965 .05272683 -.0136679 |
12. | 2012 .08884997 113.33022 -.0015957 .0451358 |
13. | 2014 .24156329 -115.83738 -.04908656 .09766839 |
14. | 2002 . . . . |
15. | 2014 .24156329 -115.83738 -.04908656 .09766839 |
|----------------------------------------------------------|
16. | 2013 -.05566587 438.12642 .04170158 -.0068965 |
17. | 2009 2.3117199 2416.5953 -1.5396779 .76984911 |
18. | 2004 . . . . |
19. | 2016 .1414304 201.14575 -.01674374 -.04160379 |
20. | 2010 -.69739426 -1098.4617 .6166464 -.54146248 |
|----------------------------------------------------------|
21. | 2005 . . . . |
22. | 2011 .25514846 -104.39973 -.06177096 .11034773 |
23. | 2015 .16020267 84.320294 -.01398477 -.11785821 |
24. | 2006 -.04683009 -52.635429 .0792364 .21267886 |
25. | 2016 .1414304 201.14575 -.01674374 -.04160379 |
+----------------------------------------------------------+
Thanks a lot.
I am dealing with missing values when using asreg. I have read Attaullah Shah's explanation of the package but I still don't know where I'm messing up.
Goal:
My aim is to calculate abnormal cash flows from operation (CFO). In order to do so I must first run a regression on CFO of each industry-year. Then I subtract those coefficients from the actual CFO for every firm.
Stata:
Run a cross-sectional regression for each industry-year and save the coefficients.
I run the following commands
bys sic : asreg CFO scassets scsales scdsales, robust window(year 5)
list year _b_cons _b_scassets _b_scsales _b_scdsales in 1/25
Problem:
My issue is the following: whenever I run the command I get missing values in certain years.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input long gvkey double year int sic str10 rating float(POST treated treated2 treated3 PROD DEXP CFO) double at float(scsales scassets) 3362 2007 2000 "BBB+" 0 0 0 1 .6884373 .1846732 .00862659 13682.5 .9805838 .00008449157 3362 2013 2000 "BBB-" 1 0 0 1 .6505319 .1247372 .07601947 19366.4 .8675491 .00004900687 3362 2012 2000 "BBB" 1 1 0 1 1.0465395 .222297 .12342355 20405.3 1.3539184 .00008739808 3362 2010 2000 "BBB" 1 1 0 1 .7840263 .1755921 .11520702 11408.7 1.0481428 .00008519339 3362 2006 2000 "BBB+" 0 0 0 1 .8010228 .19678298 .07781902 11835.5 .9937474 .00008248783 3362 2011 2000 "BBB" 1 1 0 1 .8861746 .2145906 .09221033 11441.9 1.1624988 .0000876524 3362 2015 2000 "BBB-" 1 0 0 1 .4280934 .1331361 .068828315 13390.6 .6637081 .00005700539 3362 2008 2000 "BBB+" 0 0 0 1 .7063987 .15496437 .009062671 11073.3 .9304732 .00007308606 3362 2009 2000 "BBB" 0 1 0 1 .7453424 .2042571 .13299559 11738 1.0908582 .00009030732 3362 2016 2000 "BBB" 1 1 0 1 .3398802 .11188445 .08778546 10096.3 .58450705 .00007467925 3362 2014 2000 "BBB-" 1 0 0 1 .6097158 .11453342 .076452 17542.2 .817519 .00005163582 10793 2012 2011 "BBB-" 1 0 0 1 2.7893596 .12970825 .10721705 11896 3.005871 .00009032608 5709 2014 2011 "A" 1 0 0 0 1.5670245 .1607948 .1519319 5455.619 1.895135 .00020342237 5709 2002 2011 "A" 0 0 0 0 .6962887 .17685835 .07717835 2220.196 .9173973 .0002346096 10793 2014 2011 "BBB" 1 1 0 1 2.853248 .15414305 .09673975 23956 3.086146 .00008212203 5709 2013 2011 "A" 1 0 0 0 1.584465 .162017 .13974798 4915.88 1.9175546 .0002191077 5709 2009 2011 "A" 0 0 0 0 1.4504447 .18971063 .1522946 3692.055 1.8066428 .00027651267 5709 2004 2011 "A" 0 0 0 0 1.501653 .3585828 .12315717 2533.968 1.9973395 .0004178644 5709 2016 2011 "A" 1 0 0 0 1.1768237 .1809128 .16170608 6370.067 1.5510564 .00016287093 10793 2010 2011 "BB" 1 0 1 0 4.707277 1.0666528 .9854583 10752 20.489824 .0007207114 5709 2005 2011 "A" 0 0 0 0 1.612697 .3823722 .16954516 2822.406 2.1365688 .000394638 5709 2011 2011 "A" 1 0 0 0 1.610507 .18828353 .12098888 4244.391 1.9475206 .00024667496 5709 2015 2011 "A" 1 0 0 0 1.3289115 .1671508 .1818294 6139.831 1.6980407 .00018329726 5709 2006 2011 "A" 0 0 0 0 1.5314457 .3686181 .115995 3060.306 2.035668 .00035430765 10793 2016 2011 "BBB" 1 1 0 1 1.3624152 .09394018 .11806642 22373 1.603243 .0000434707 10793 2011 2011 "BB+" 1 0 0 0 2.783575 .14025298 .09728423 11071 3.00093 .00009300595 5709 2010 2011 "A" 1 0 0 0 1.6029158 .2018369 .13150725 4053.918 1.9557452 .00027085186 10793 2015 2011 "BBB" 1 1 0 1 1.5148606 .11362498 .10728002 23004 1.7270412 .0000417432 5709 2012 2011 "A" 1 0 0 0 1.6124865 .17412816 .12199182 4563.966 1.9391875 .00023560507 5709 2003 2011 "A" 0 0 0 0 1.4182874 .362713 .1140665 2393.121 1.8918726 .0004504107 10793 2013 2011 "BBB" 1 1 0 1 2.650723 .13349025 .1104573 12177 2.889543 .00008406187 5709 2007 2011 "A" 0 0 0 0 1.5448792 .3423619 .11033504 3393.65 2.0236642 .0003267647 5709 2008 2011 "A" 0 0 0 0 1.5453984 .3340091 .08032414 3616.471 1.9904536 .000294668 12785 2014 2015 "BB" 1 0 1 0 2.2155902 .06203312 .3362411 3119.063 2.705636 .00031521855 170527 2016 2015 "B" 1 0 0 0 .3650492 .11268491 .05448787 9360.6 .5451824 .00010845516 170527 2012 2015 "B+" 1 0 0 0 .26878026 .3094643 .1124473 2732.3 .7487896 .000780884 12785 2015 2015 "BB" 1 0 1 0 2.17523 .06818747 .3131799 3318.443 2.622616 .0003206091 170527 2013 2015 "B" 1 0 0 0 .21201918 .14998353 .04362625 3473.8 .3784724 .000365992 12785 2012 2015 "B" 1 0 0 0 2.475329 .05908879 .06296294 2913.869 2.561546 .0003154077 12785 2016 2015 "BB" 1 0 1 0 2.064814 .06309616 .2276619 3008.218 2.390013 .00030134615 170527 2014 2015 "B" 1 0 0 0 .557689 .15703264 .05270885 7731.1 .6940814 .0002878692 170527 2015 2015 "B" 1 0 0 0 .43944585 .11094152 .05841342 9220.4 .601234 .0001293477 12785 2013 2015 "B" 1 0 0 0 2.4994414 .06510759 .3015005 3172.402 2.886591 .0003431863 62655 2011 2020 "B+" 1 0 0 0 1.2303208 .3467688 .05646711 5754.363 1.6408243 .00012568076 62655 2009 2020 "BB-" 0 0 0 0 1.1139048 .3725135 .09355895 7843.941 1.584955 .00014204158 62655 2016 2020 "BB-" 1 0 0 0 2.215955 .6891779 .10182416 2606.227 3.049913 .0003955673 62655 2015 2020 "BB-" 1 0 0 0 2.1660056 .641507 .14736702 2528.015 2.932393 .0003610583 180833 2014 2020 "BBB" 1 1 0 1 .4690999 .7117527 .2283757 3776.5 1.269192 .00028784433 124554 2003 2020 "B" 0 0 0 0 .3330927 .2638978 .05275728 158.494 .5735661 .0044558514 124554 2004 2020 "B" 0 0 0 0 .4485659 .3648719 -.003337666 148.374 .7304882 .004607934 180833 2010 2020 "BBB" 1 1 0 1 .54663575 .6991258 .2483698 2293.1 1.5174612 .0004830218 62655 2010 2020 "B+" 1 0 0 0 1.1269369 .3498856 .0681373 7956.667 1.5455097 .00012748693 180833 2013 2020 "BBB" 1 1 0 1 .4752931 .6115033 .24756 3474.1 1.28927 .0003069179 124554 2002 2020 "B" 0 0 0 0 .05437573 .12980792 .00302532 224.424 .24946304 .0014551805 180833 2009 2020 "BBB" 0 1 0 1 .1045552 .13254008 .05889082 2070.3 .28868347 .0001021346 124554 2006 2020 "B-" 0 0 0 0 .783308 .3833778 .0005940799 180.477 1.1230181 .004607934 180833 2012 2020 "BBB" 1 1 0 1 .4732543 .6439931 .25036144 3258.2 1.4100405 .0003614284 124554 2005 2020 "B-" 0 0 0 0 .7544179 .4105639 -.029331284 183.477 1.0091795 .004607934 62655 2014 2020 "B+" 1 0 0 0 2.733973 .5958056 .05458371 2769.636 3.3915215 .0003568822 62655 2013 2020 "B+" 1 0 0 0 1.2050616 .29052427 -.05567715 2802.045 1.585401 .0001758368 180833 2011 2020 "BBB" 1 1 0 1 .6389604 .9181021 .2759583 2766.8 1.6035062 .0004360909 62655 2012 2020 "B+" 1 0 0 0 1.4385157 .4618167 .07655791 5687.091 1.991928 .0001737812 180833 2016 2020 "BBB" 1 1 0 1 .3076461 .5531877 .17298217 4087.7 .9361197 .0002501188 62655 2008 2020 "BB-" 0 0 0 0 4.707277 2.2161098 .9287363 7040.192 16.111132 .0012935874 180833 2015 2020 "BBB" 1 1 0 1 .3376936 .6296836 .2409374 3998.1 1.0780617 .00026479544 2663 2013 2030 "BBB+" 1 0 0 1 .7470138 .3520674 .156049 8323 1.233078 .00015313935 2663 2016 2030 "BBB+" 1 0 0 1 .5983434 .2635678 .1808629 7837 .984176 .00012362468 2663 2011 2030 "A" 1 0 0 0 .7001275 .3774697 .18196303 6862 1.2299235 .00015933716 185334 2016 2030 "BB-" 1 0 0 0 .4022305 .0783853 .09129146 6739.645 .58574706 .000187263 2663 2014 2030 "BBB+" 1 0 0 1 .6167247 .25964195 .10801394 8113 .9933918 .00012014899 2663 2012 2030 "A-" 1 0 0 0 .6417954 .3478578 .16321772 6530 1.1231419 .0001457301 185334 2014 2030 "B+" 1 0 0 0 .3582445 .06357781 .10838207 5200.945 .5099558 .00019680425 2663 2015 2030 "BBB+" 1 0 0 1 .6123505 .25391346 .1456921 8089 .996179 .00012325897 185334 2013 2030 "B" 1 0 0 0 .39567265 .0770777 .05960062 5081.191 .5594338 .00022727334 185334 2012 2030 "B" 1 0 0 0 .4053441 .07759278 .04962522 4399.988 .6063275 .00024463635 2663 2010 2030 "A" 1 0 0 0 1.2898895 .737967 .321795 6276 2.3368952 .0003044418 185334 2015 2030 "BB-" 1 0 0 0 .3608185 .06460672 .071700625 5340.083 .51063645 .00019227275 9777 2016 2033 "BBB" 1 1 0 1 .27188894 .10135072 .06625334 15639.7 .4622406 .00006256217 9777 2013 2033 "BBB+" 1 0 0 1 .3770234 .12599924 .09477624 9072.1 .6212051 .0001107199 9777 2015 2033 "BBB" 1 1 0 1 .25738332 .10324831 .08637887 15984.1 .4626775 .00005923258 9777 2014 2033 "BBB+" 1 0 0 1 .4129033 .12912115 .08081921 16882.6 .6274953 .00011022806 9777 2011 2033 "BBB+" 1 0 0 1 .5050382 .1532099 .10824535 9115.226 .8183287 .00014809283 9777 2012 2033 "BBB+" 1 0 0 1 .4057852 .12401228 .09388687 9031.8 .6470163 .00010970655 5071 2007 2040 "BBB+" 0 0 0 1 .46685 .18964474 .09513308 19041.6 .7507754 .0000549934 6375 2012 2040 "BBB+" 1 0 0 1 .7143937 .4295437 .14771868 15184 1.192925 .00008402655 5071 2015 2040 "BBB+" 1 0 0 1 .4490155 .1864554 .11972956 21712.3 .754085 .00004552801 6375 2009 2040 "BBB+" 0 0 0 1 .6134661 .4222547 .1501005 11200 1.1488215 .00009135757 5071 2008 2040 "BBB+" 0 0 0 1 .4718196 .20484097 .09601084 17874.8 .7715371 .0000525166 5071 2006 2040 "BBB+" 0 0 0 1 .42033285 .17158236 .09694073 18184 .6833636 .00005492393 5071 2013 2040 "BBB+" 1 0 0 1 .48308325 .20071498 .11214582 23145.7 .7904316 .00004413452 5071 2005 2040 "BBB+" 0 0 0 1 .3621167 .1857633 .09802945 18207 .6443042 .0000553526 5071 2014 2040 "BBB+" 1 0 0 1 .4751768 .18835896 .10986058 21964.5 .7617095 .00004320457 6375 2005 2040 "BBB+" 0 0 0 1 .4787403 .3571693 .1059553 10574.5 .9431717 .00009267497 6375 2011 2040 "BBB+" 1 0 0 1 .6281759 .4032244 .13463324 11901 1.1140373 .00008440956 5071 2004 2040 "BBB+" 0 0 0 1 .3455659 .16603425 .09274718 18066 .609497 .00005420642 5071 2011 2040 "BBB+" 1 0 0 1 .5323409 .2425018 .12862459 21096.8 .8920132 .00005354896 6375 2014 2040 "BBB+" 1 0 0 1 .5732842 .3335918 .11587179 15153 .9424195 .00006462453 5071 2012 2040 "BBB+" 1 0 0 1 .5124901 .22031303 .13869402 22658 .8425022 .00004740055 6375 2015 2040 "BBB" 1 1 0 1 .5225368 .3028443 .11159506 15265 .8890648 .00006599353 6375 2007 2040 "BBB+" 0 0 0 1 .5882117 .4171178 .14028373 11397 1.0991226 .00009333582 end
. list year _b_cons _b_scassets _b_scsales _b_scdsales in 1/25
+----------------------------------------------------------+
| year _b_cons _b_scass~s _b_scsales _b_scdsa~s |
|----------------------------------------------------------|
1. | 2007 . . . . |
2. | 2013 -.04137871 -1454.5413 .26266831 -.35338505 |
3. | 2012 -.38693713 3034.2662 .21646971 -.27079479 |
4. | 2010 -.85324587 -8938.4823 1.6439263 -.12898214 |
5. | 2006 . . . . |
|----------------------------------------------------------|
6. | 2011 -.16358315 -12266.271 1.2316633 -.93329911 |
7. | 2015 -.02253046 -724.27971 .16337456 -.08283015 |
8. | 2008 . . . . |
9. | 2009 . . . . |
10. | 2016 .01235643 950.81255 .01738386 .02459045 |
|----------------------------------------------------------|
11. | 2014 .00971925 449.31965 .05272683 -.0136679 |
12. | 2012 .08884997 113.33022 -.0015957 .0451358 |
13. | 2014 .24156329 -115.83738 -.04908656 .09766839 |
14. | 2002 . . . . |
15. | 2014 .24156329 -115.83738 -.04908656 .09766839 |
|----------------------------------------------------------|
16. | 2013 -.05566587 438.12642 .04170158 -.0068965 |
17. | 2009 2.3117199 2416.5953 -1.5396779 .76984911 |
18. | 2004 . . . . |
19. | 2016 .1414304 201.14575 -.01674374 -.04160379 |
20. | 2010 -.69739426 -1098.4617 .6166464 -.54146248 |
|----------------------------------------------------------|
21. | 2005 . . . . |
22. | 2011 .25514846 -104.39973 -.06177096 .11034773 |
23. | 2015 .16020267 84.320294 -.01398477 -.11785821 |
24. | 2006 -.04683009 -52.635429 .0792364 .21267886 |
25. | 2016 .1414304 201.14575 -.01674374 -.04160379 |
+----------------------------------------------------------+
Thanks a lot.
Comment