Code:
gen gics_2di =(gics_code-mod(gics_code,10000))/10000 egen code = group(ticker) tsset code year //***ABACC gen ta_a = ta/l.totassets gen a_1 = 1/l.totassets gen revchange_a = revchange/l.totassets gen ppe_a = ppe/l.totassets rangestat (reg) ta_a a_1 revchange_a ppe_a, by(gics_2di) interval(year -15 0)
The data and result should be like this:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str5 ticker float(year gics_2di ta_a a_1 revchange_a ppe_a) double(reg_nobs b_a_1 b_revchange_a b_ppe_a b_cons) "AAA" 2003 15 . . . . . . . . . "AAA" 2004 15 . . . . 1 . . . . "AAA" 2005 15 . . . . 25 . . . . "AAA" 2006 15 . . . . 56 . . . . "AAA" 2007 15 . . . . 92 . . . . "AAA" 2008 15 . . . . 137 . . . . "AAA" 2009 15 -.05188835 3.6855293e-12 .5019693 .8268633 202 . . . . "AAA" 2010 15 .2088325 2.294363e-12 .6763351 .8757771 278 1584085939.736831 .12708950132613406 .05657954920865471 -.07968150937740576 "AAA" 2011 15 .012144913 1.5504392e-12 .3586467 .7700721 357 1653130186.7238574 .12304488450062984 .04250903784775931 -.06838153326464892 "AAA" 2012 15 -.06748654 1.2245628e-12 .12172044 .6552734 439 1796246290.7076917 .10843686785100161 .03259520754244283 -.05762622365820059 "AAA" 2013 15 -.03477767 1.110502e-12 .16377077 .8288529 528 1855507585.5310318 .10484449294948195 .0081626947382177 -.03851675489681643 "AAA" 2014 15 -.05060567 8.69135e-13 .3503795 .764523 621 1820172009.2382293 .10735836019288442 .008632049216262948 -.03404546181289806 "AAA" 2015 15 .0728228 7.034077e-13 .03791743 .7684436 725 1844540524.2672079 .10502553909163503 .004908517100251392 -.03251337769978387 "AAA" 2016 15 .02589748 5.1157055e-13 .2707338 .9813811 834 1840205714.4097126 .10291879354879138 -.002550035728466571 -.02461432340197646 "AAA" 2017 15 .10771796 3.249268e-13 .6257566 .9116007 947 1818594860.0648074 .10406992428809676 -.005796115008249517 -.01847536830811619 "AAA" 2018 15 .03279573 2.1852397e-13 .8614137 .8886017 1063 1905972664.3830402 .09622948327168132 -.0119113933157124 -.012175509251885111 "AAA" 2019 15 -.01036422 1.3281683e-13 .16555625 .43516 1181 1925427312.0034378 .09591158063414375 -.0166303016195546 -.011054076888552093 "AAM" 2004 30 . . . . . . . . . "AAM" 2005 30 . . . . 15 . . . . "AAM" 2006 30 . . . . 40 . . . . "AAM" 2007 30 1.0831021 1.4571764e-11 .12244625 .6022781 67 . . . . "AAM" 2008 30 -.06497576 3.214369e-12 .16566242 .17546953 99 . . . . "AAM" 2009 30 .04947018 3.326073e-12 .2157253 .25924137 140 . . . . "AAM" 2010 30 .10391025 2.747744e-12 .10173995 .24104966 184 . . . . "AAM" 2011 30 .06985304 3.018082e-12 .4191923 .25240043 228 . . . . "AAM" 2012 30 -.04962417 3.030517e-12 -.465879 .23865224 273 . . . . "AAM" 2013 30 -.04462884 3.499432e-12 .16769205 .27919668 322 . . . . "AAM" 2014 30 -.04268124 3.3104745e-12 -.3127411 .2606126 371 . . . . "AAM" 2015 30 .008665917 3.364839e-12 -.3007686 .2676917 422 . . . . "AAM" 2016 30 -.0012889402 3.106229e-12 -.23250994 .2457513 475 . . . . "AAM" 2017 30 -.2301546 3.8774153e-12 -.19615464 .318954 533 . . . . "AAM" 2018 30 -.05868362 3.975185e-12 -.023554154 .3396268 592 . . . . "AAM" 2019 30 .13503978 4.3486e-12 -.0093145 .3804228 651 . . . . "AAM" 2020 30 .04339687 4.39545e-12 -.4186026 .3865967 708 . . . . "AAV" 2004 60 . . . . . . . . . "AAV" 2005 60 . . . . 4 . . . . "AAV" 2006 60 . . . . 11 . . . . "AAV" 2007 60 . . . . 27 . . . . "AAV" 2008 60 . . . . 47 . . . . "AAV" 2009 60 . . . . 75 . . . . end
0 Response to Issue with cross-sectional regression using rangestat
Post a Comment