I have Stata 17 and I am using the etable command to export my regression results to an excel file.
Here are the commands I used:
regress lnTotalComp ESGScFY2020 TAFY2020 Big4 EPSFY2020 ROICFY2020 OPMFY2020 LevFY2020 i.sector i.hq_ctry
estimates store ESGTA
etable, estimates(ESGTA) keep(ESGScFY2020 TAFY2020 Big4 EPSFY2020 ROICFY2020 OPMFY2020 LevFY2020) column(index) cstat(_r_b, nformat(%6.7f)) cstat(_r_se, nformat(%6.7f)) showstars showstarsnote stars(.1 "*" .05 "**" .01 "***", attach(_r_b)) mstat(N, nformat(%6.0f) label("No. of obs")) mstat(r2_a, nformat(%6.7fc) label("Adjusted R-squared")) mstat(F, nformat(%6.7fc) label("F-stat")) mstat(df_m, nformat(%6.7fc) label("Num deg of freedom")) mstat(df_r, nformat(%6.7fc) label("Denom deg of freedom")) title("Regression Model for ESG and Executive Pay") export ("C:\Users\raosunit\Documents\Sabbatical Spring 2023\SPARK Meeting submission\ResultsFeb5\v1.xlsx", replace)
Stata is giving me the following error:
etable, estimates(ESGTA) keep(ESGScFY2020 TAFY2020 Big4 EPSFY2020 ROICFY2020 OPMFY2020 LevFY2020)
column(index)
cstat(_r_b, nformat(%6.7f)) cstat(_r_se, nformat(%6.7f))
showstars showstarsnote stars(.1 "*" .05 "**" .01 "***", attach(_r_b))
mstat(N, nformat(%6.0f) label("No. of obs")) mstat(r2_a, nformat(%6.7fc) label("Adjusted R-squared"))
mstat(F, nformat(%6.7fc) label("F-stat")) mstat(df _m, nformat(%6.7fc) label("Num deg of freedom"))
mstat(df_r, nformat(%6.7fc) label("Denom deg of freedom"))
title("Regression Model for ESG and Executive Pay") export (v1.xlsx, replace)
%6.7f invalid numeric format
in option cstat()
r(120);
I checked the Stata Manual and it allows nformat for both cstat and mstat. What am I doing wrong?
Here is a sample my data:
Here are the commands I used:
regress lnTotalComp ESGScFY2020 TAFY2020 Big4 EPSFY2020 ROICFY2020 OPMFY2020 LevFY2020 i.sector i.hq_ctry
estimates store ESGTA
etable, estimates(ESGTA) keep(ESGScFY2020 TAFY2020 Big4 EPSFY2020 ROICFY2020 OPMFY2020 LevFY2020) column(index) cstat(_r_b, nformat(%6.7f)) cstat(_r_se, nformat(%6.7f)) showstars showstarsnote stars(.1 "*" .05 "**" .01 "***", attach(_r_b)) mstat(N, nformat(%6.0f) label("No. of obs")) mstat(r2_a, nformat(%6.7fc) label("Adjusted R-squared")) mstat(F, nformat(%6.7fc) label("F-stat")) mstat(df_m, nformat(%6.7fc) label("Num deg of freedom")) mstat(df_r, nformat(%6.7fc) label("Denom deg of freedom")) title("Regression Model for ESG and Executive Pay") export ("C:\Users\raosunit\Documents\Sabbatical Spring 2023\SPARK Meeting submission\ResultsFeb5\v1.xlsx", replace)
Stata is giving me the following error:
etable, estimates(ESGTA) keep(ESGScFY2020 TAFY2020 Big4 EPSFY2020 ROICFY2020 OPMFY2020 LevFY2020)
column(index)
cstat(_r_b, nformat(%6.7f)) cstat(_r_se, nformat(%6.7f))
showstars showstarsnote stars(.1 "*" .05 "**" .01 "***", attach(_r_b))
mstat(N, nformat(%6.0f) label("No. of obs")) mstat(r2_a, nformat(%6.7fc) label("Adjusted R-squared"))
mstat(F, nformat(%6.7fc) label("F-stat")) mstat(df _m, nformat(%6.7fc) label("Num deg of freedom"))
mstat(df_r, nformat(%6.7fc) label("Denom deg of freedom"))
title("Regression Model for ESG and Executive Pay") export (v1.xlsx, replace)
%6.7f invalid numeric format
in option cstat()
r(120);
I checked the Stata Manual and it allows nformat for both cstat and mstat. What am I doing wrong?
Here is a sample my data:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input byte ESGScFY2020 double TAFY2020 byte Big4 double(EPSFY2020 ROICFY2020 OPMFY2020) float LevFY2020 byte(sector hq_ctry) 0 1259.126 1 -.40469 -3.9298 6.147 4.712845 6 51 0 31.584 0 -.03742 -2.1577 .0664 .3783013 2 51 21 494.629 1 2.15778 21.2963 24.4052 .1984057 8 51 22 4471.457 1 -.21425 -5.4895 12.3156 5.493474 2 51 0 75.233 0 -158.4122 -31.6418 -2.8411 -4.1565194 7 51 8 153.004 0 3.14289 4.7287 7.0719 .73201 7 51 13 1984.717 1 1.18764 4.0383 9.3294 1.227963 9 51 13 886.8 1 -1.7 -10.5969 4.634 1.547644 2 51 9 56.8 1 5.23355 18.6744 10.6101 .07060865 2 51 11 1729.179 1 2.51137 3.3607 9.278 1.8434095 2 51 16 34.348 0 4.39272 18.2699 22.3257 .024401125 6 51 . 21.063 0 -.03959 -47.8677 -9.4614 -8.039313 8 51 33 16608 1 3.08311 1.8857 4.5035 1.4936595 3 10 0 817.181 0 -1.63769 -7.4346 4.2535 .5900641 3 51 0 0 1 -.49336 -173.9989 . 0 7 51 60 36366 1 5.58873 4.5077 24.5979 .5747021 6 51 10 781.8 1 10.95095 10.6102 16.6223 .2421483 8 51 83 1121.008 1 -1.13572 -9.3326 -4.7696 .7191033 2 10 0 2034.303 0 -1.64001 -12.8466 -46.851 -10.228385 2 51 25 7260 1 .05843 -.7708 3.4973 .9340023 3 50 0 568.617 1 -6.72351 -36.177 -1.9346 6.768847 2 10 0 713.247 1 .29674 1.9097 4.6662 2.6250496 2 51 0 11.108 1 .09926 9.8909 4.3934 .0850979 7 50 0 179.556 1 -.00301 -1.2948 -4.4722 1.0197121 2 1 33 1731.874 1 -.30934 -2.0329 1.3195 .4647582 8 51 21 4493.3 1 -2.34063 -17.3719 2.3763 1.9738623 2 51 21 37375 1 6.06821 2.6862 4.9675 1.8693107 3 43 11 7.9 1 .265 5.0704 14.7829 .03792607 3 50 9 237.254 1 1.4851 8.8774 5.3455 .7978598 2 51 60 7677 1 .93351 -.1646 6.4334 2.3151388 2 51 11 755.465 1 -.11104 -5.6091 -.0477 1.4251583 2 51 0 296.076 0 .76599 7.3056 4.5947 1.8516207 2 51 8 1223.279 1 1.28389 1.4937 3.9975 1.6968446 2 51 15 10031 1 3.48651 6.3144 6.71 1.6037283 2 51 10 1230.292 1 1.52857 3.3727 4.6476 1.8952937 2 51 22 2387.4 1 1.40426 -.0915 5.2207 1.2977822 2 5 16 3487.9 1 4.63348 24.6745 13.3809 1.0382975 2 51 18 1767.426 1 .61088 -.5581 3.7568 1.6499835 2 51 10 1600.896 1 1.12696 4.7614 7.3844 1.2829204 2 51 18 1938.347 1 12.20513 24.9421 12.1801 1.0190595 2 51 15 3318 1 4.51702 7.7662 8.9069 1.3416903 2 51 0 184.313 1 -.97742 . -190.0621 .9278045 8 51 20 2028.7 1 .05057 10.1488 8.5798 1.5736115 2 50 12 1868.005 1 11.54866 11.8372 14.3865 100.15575 2 51 19 3100.416 1 3.39949 5.864 4.9517 1.790494 2 51 27 11464.474 1 2.7084 17.6486 10.5861 1.9273815 2 51 23 1196.116 1 1.35004 3.9014 5.6099 1.7957597 2 51 0 101.074 1 -4.56599 -129.7656 -66.5861 -2.055185 8 51 0 0 1 -.35234 -23.2209 -20.3864 0 8 51 0 261.9 1 -14.03604 . -44.8423 -7.748521 2 51 8 0 1 -.76802 -24.4345 -33.3986 0 8 51 0 0 1 -1.96491 . -34.7982 0 8 51 48 6257 1 .15199 .4247 2.7079 .184654 8 51 11 0 1 -.95757 -34.8897 -30.3408 0 8 51 11 986.828 1 -3.13774 -22.6317 -35.0626 11.90987 8 51 18 1301.096 1 .59177 2.8245 20.5109 1.2628384 6 51 0 0 1 -2.76361 . -158.0348 0 8 51 0 78.588 1 -.75047 -38.0344 -31.0316 .4772773 8 51 0 23.864 1 -4.50333 -45.9167 -12.2595 .23427086 6 51 11 1359.088 1 1.68377 7.8119 6.5376 .9338533 2 51 0 0 1 -1.96491 . -34.7982 0 8 51 0 .30701 0 -.05801 -1010.7775 . -1.1671609 6 10 14 300.207 1 -.01265 -5.2196 -.059 .629708 6 1 0 .069 0 -.00873 -41.2731 . .01532652 6 50 9 72.467 1 .09309 4.715 2.039 .08689683 8 51 9 123.827 1 -1.08755 -59.3493 -41.1449 .6154056 8 51 0 0 0 -1.06624 -17.9987 -6.774 0 2 51 13 597.248 1 -.79498 -15.372 -11.6391 .7194736 8 51 30 2544.6 1 .97633 10.0179 11.4009 -18.293314 8 51 0 57.46 1 -2.88622 . -111.2016 .2640176 7 51 23 4018 1 .09729 1.9856 19.6506 1.0646529 4 33 8 10.156 1 -1.3539 -10.2064 -21.7061 .022666 8 51 48 6257 1 .15199 .4247 2.7079 .184654 8 51 6 15.623 1 .39184 1.6242 .2082 .034441784 4 51 9 424.541 1 -.9769 -48.8308 -20.0314 18.989176 8 51 0 19.598 1 -2.34061 . -161.3461 -.8754188 8 51 6 223.495 0 .58563 6.0251 4.5657 1.2690936 2 51 6 223.495 0 .58563 6.0251 4.5657 1.2690936 2 51 18 1301.096 1 .59177 2.8245 20.5109 1.2628384 6 51 7 1390.611 1 1.8498 3.1173 5.0178 2.217244 2 51 26 1569.858 1 -2.11578 -13.3157 -13.8461 .6313396 8 51 19 1104.28 1 -1.78221 -19.0649 -31.1198 2.724303 8 51 15 970.787 1 .43376 1.3456 .9836 .7813571 8 51 5 550.069 1 1.69687 1.9393 5.3074 1.2883083 3 10 0 0 1 -.47134 . -10.9564 0 8 51 0 0 1 -6.18079 -121.5535 -54.0488 0 8 51 0 23.864 1 -4.50333 -45.9167 -12.2595 .23427086 6 51 8 10.156 1 -1.3539 -10.2064 -21.7061 .022666 8 51 0 20.933 1 -.90211 . -46.3603 .22233906 8 51 9 123.827 1 -1.08755 -59.3493 -41.1449 .6154056 8 51 75 6850 1 1.16845 8.6587 16.8988 .4582246 2 45 74 2643 1 1.14637 18.3825 26.067 .21656834 8 51 8 10.156 1 -1.3539 -10.2064 -21.7061 .022666 8 51 19 1104.28 1 -1.78221 -19.0649 -31.1198 2.724303 8 51 54 2607.955 1 3.73911 5.0397 4.2904 .4453728 7 51 32 11868 1 5.67769 5.4804 7.2062 .7713506 3 51 26 62323 1 -1.58407 -2.8732 5.7824 .6391316 1 51 12 401.673 1 2.02362 6.8832 3.7509 .24643785 8 51 0 1372.584 1 .37419 13.7295 13.4841 -1.6597166 2 51 1 150633 0 343.18868 3.877 5.3544 1.213999 2 27 end label values sector sector label def sector 1 "Communication Services", modify label def sector 2 "Consumer Discretionary", modify label def sector 3 "Consumer Staples", modify label def sector 4 "Energy", modify label def sector 6 "Health Care", modify label def sector 7 "Industrials", modify label def sector 8 "Information Technology", modify label def sector 9 "Materials", modify label values hq_ctry hq_ctry label def hq_ctry 1 "Australia", modify label def hq_ctry 5 "Bermuda", modify label def hq_ctry 10 "Canada", modify label def hq_ctry 27 "Japan", modify label def hq_ctry 33 "Malaysia", modify label def hq_ctry 43 "South Africa", modify label def hq_ctry 45 "Spain", modify label def hq_ctry 50 "United Kingdom", modify label def hq_ctry 51 "United States", modify
Comment