Search code examples
stata

Dropping dummies in esttab


I tried creating a table using the community-contributed family of commands estout:

esttab est1 est2 est3 using table3.tex, se label nobaselevels ///
star(* 0.10 ** 0.05 *** 0.01) cell((coef(fmt(%9.2f)) sd(fmt(%9.2f)))) ///
drop(_Iprovince* _Iyear*) stats(year province robust r2 N, ///
label("Year Fixed Effects" "Province Fixed Effects" "Robust SE" "R-squared")) ///
replace booktabs

However, Stata produces the following error:

coefficient _Iprovince* not found

These are "fixed effect" dummies that I want to drop them out.

The code works fine when I take out cell().

Finally, how can I also round up the coefficient estimates and standard errors?


Solution

  • Unless you have a very old version of Stata, don't use xi to create your FEs. Use factor variable notation i.province and i.year instead.

    The principal problem with your code is that you should have b instead of coef (Stata cannot drop coefficients since they are not included unless you tell Stata that you want them):

    sysuse auto
    eststo est1: reg price mpg i.rep78
    esttab est1, ///
    stats(b year province robust r2 N, label("Year Fixed Effects" "Province Fixed Effects" "Robust SE" "R-squared")) ///
    replace booktabs drop(*.rep78) se label nobaselevels star(* 0.10 ** 0.05 *** 0.01) cell((b(fmt(%9.2f)) sd(fmt(%9.2f))))
    

    Note the reproducible example on a shared dataset.