# Using year fixed effects on data with yearly observations

I have a panel data set with yearly observations of various firms over a period of 5 years. I am running a fixed effects model in Stata using xtreg. Is it problematic to include a dummy variable for individual years, since I have yearly observations? (I would exclude a reference dummy.)

Here is the Stata code I would be using:

xtreg y x i.year, fe

• Have you xtset your data? – robin.datadrivers Dec 9 '14 at 19:59
• He must have, otherwise xtreg provides an error message. – Andy Dec 9 '14 at 20:05
• Yes, the xtset command has been performed. – Morten Thomassen Dec 9 '14 at 20:28

## 1 Answer

It's not problematic and is even a good idea. The year dummies will pick up any variation in the outcome that happen over time and that is not attributed to your other explanatory variables. The other thing with fixed effects estimation in Stata is that many people are deceived by the xtset command where you can set a panel and a time variable. Only the panel variable is used to eliminate the individual (or in this case firm) fixed effects but it does nothing about the time fixed effects. So xtreg will perform the within transformation using the specified panel id but if you want to control for year fixed effects you need to include the dummies as you suggest.