# How to take account for industry and year effects?

Controlling for variables like, firm size etc, is quite obvious. But I really have no idea on how to control for industry effects and year effects. I've read that you must insert dummy variables, with two digits SIC of GICS codes. But how does one do that in SPSS (or Stata).

-

In STATA, you can use the xi functionality that's built in. Let industry be a variable indicating the industry of each observation and year being the year variable. If you have a simple regression of y on x, then adding the industry and year fixed effects is as simple as

xi: regress y x i.industry i.year


The command xi says that there is some x variable that you want to become a set of dummy or indicator variables based on each different value the variable can have. The i. simple tells STATA which variables you would like to transform.

STATA automatically drops one of the created dummy/indicator variables so that your model does not suffer from exact multiconliearity.

-
In newer versions of Stata, you don't even need the xi prefix. –  Dimitriy V. Masterov Mar 9 '12 at 16:19
True, but I find that adding the xi: prefix can still be useful because Stata automatically creates the dummy variables. It might be handy to have them especially for postestimation commands (though it's not necessary at all to have them). –  andrea Mar 12 '12 at 9:02