Stata 15 help for set emptycells

[R] set emptycells -- Set what to do with empty cells in interactions


set emptycells {keep | drop} [, permanently]


set emptycells allows you to control how Stata handles interaction terms with empty cells. Stata can keep empty cells or drop them. The default is to keep empty cells.


permanently specifies that, in addition to making the change right now, the setting be remembered and become the default setting when you invoke Stata.


By default, Stata keeps empty cells so they can be reported in the coefficient table. For example, type

. webuse auto . regress mpg rep78#foreign, baselevels

and you will see a regression of mpg on 10 indicator variables because rep78 takes on 5 values and foreign takes on 2 values in the auto dataset. Two of those cells will be reported as empty because the data contain no observations of foreign cars with a rep78 value of 1 or 2.

Many real datasets contain a large number of empty cells, and this could cause the "matsize too small" error, r(908). In that case, type

. set emptycells drop

to get Stata to drop empty cells from the list of coefficients. If you commonly fit models with empty cells, you can permanently set Stata to drop empty cells by typing the following:

. set emptycells drop, permanently

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index