I encountered a weird problem when trying to export results from regression. The code I used is based on the help file of outreg2:
I always get a "invalid syntax" error for the "addstat" command. The full output is
However, when I delete the F-statistic here, i.e., use just addstat(Pseudo R-squared, `e(r2_p)'), it works perfectly. Why does this happen?
Code:
probit access sp500 nyse $xvars utility_ind i.fyear, vce(cluster id) test sp500 = nyse = 0 local fstat = r(F) outreg2 using Table7, excel stats(coef se) keep($xvars) nocons alpha(0.01, 0.05, 0.1) symbol(*,**,***) dec(3) /// addstat(Pseudo R-squared, `e(r2_p)', F-statistic, `fstat') adec(3) append
Code:
. probit access sp500 nyse $xvars utility_ind i.fyear, vce(cluster id) Iteration 0: log pseudolikelihood = -31829.721 Iteration 1: log pseudolikelihood = -17721.457 Iteration 2: log pseudolikelihood = -16911.605 Iteration 3: log pseudolikelihood = -16892.798 Iteration 4: log pseudolikelihood = -16892.791 Iteration 5: log pseudolikelihood = -16892.791 Probit regression Number of obs = 59,912 Wald chi2(26) = 2273.63 Prob > chi2 = 0.0000 Log pseudolikelihood = -16892.791 Pseudo R2 = 0.4693 (Std. Err. adjusted for 9,541 clusters in id) --------------------------------------------------------------------------------- | Robust access | Coef. Std. Err. z P>|z| [95% Conf. Interval] ----------------+---------------------------------------------------------------- sp500 | .4410144 .0800983 5.51 0.000 .2840246 .5980042 nyse | .2845788 .0443843 6.41 0.000 .1975871 .3715705 log_mv_assets | .4867428 .0197082 24.70 0.000 .4481153 .5253702 log_1plus_age | .068075 .0242086 2.81 0.005 .020627 .1155229 profit_margin | -.1272283 .0347415 -3.66 0.000 -.1953204 -.0591362 ppe2bv_assets | .136199 .0820912 1.66 0.097 -.0246968 .2970947 mkt2book | -.1804552 .019395 -9.30 0.000 -.2184687 -.1424417 rd2sales | -.078013 .0624374 -1.25 0.211 -.2003881 .0443622 ad2sales | .0955271 .2052 0.47 0.642 -.3066576 .4977117 lag_cum_ret_use | .0525204 .0125297 4.19 0.000 .0279627 .0770782 vol_asset | -1.486623 .1096425 -13.56 0.000 -1.701518 -1.271727 utility_ind | -.0714785 .1198726 -0.60 0.551 -.3064245 .1634675 | fyear | 1987 | .060118 .0235873 2.55 0.011 .0138878 .1063483 1988 | .0006752 .0305946 0.02 0.982 -.0592891 .0606394 1989 | -.1940478 .0335376 -5.79 0.000 -.2597802 -.1283153 1990 | -.3608065 .0360635 -10.00 0.000 -.4314897 -.2901233 1991 | -.3422037 .0381232 -8.98 0.000 -.4169237 -.2674836 1992 | -.3662483 .0388025 -9.44 0.000 -.4422998 -.2901969 1993 | -.3046348 .0389579 -7.82 0.000 -.3809909 -.2282786 1994 | -.3791964 .0394049 -9.62 0.000 -.4564285 -.3019643 1995 | -.410071 .0412203 -9.95 0.000 -.4908613 -.3292807 1996 | -.3735554 .0417193 -8.95 0.000 -.4553238 -.291787 1997 | -.2903574 .0426445 -6.81 0.000 -.373939 -.2067758 1998 | -.2207306 .0429638 -5.14 0.000 -.3049381 -.1365232 1999 | -.1390364 .0457177 -3.04 0.002 -.2286415 -.0494313 2000 | -.1995982 .0462516 -4.32 0.000 -.2902497 -.1089467 | _cons | -3.249555 .1199023 -27.10 0.000 -3.484559 -3.014551 --------------------------------------------------------------------------------- Note: 92 failures and 0 successes completely determined. . test sp500 = nyse = 0 ( 1) [access]sp500 - [access]nyse = 0 ( 2) [access]sp500 = 0 chi2( 2) = 71.71 Prob > chi2 = 0.0000 . local fstat = r(F) . outreg2 using Table7, excel stats(coef se) keep($xvars) nocons alpha(0.01, 0.05, 0.1) symbol(*,**,***) dec(3) /// > addstat(Pseudo R-squared, `e(r2_p)', F-statistic, `fstat') adec(3) append invalid syntax r(198); end of do-file
Comment