Some tips on using STATA for panel data

(These tips come from a past TA who kindly shared them with me)

The most important thing to do when working with panel data is to tell stata what variable is your t (time index) and what variable is i (cross section index). The following webpage gives an example:

http://dss.princeton.edu/online_help/analysis/panel.htm

The main command is tsset (used to set time and individual variable). Once this is done you can run

xtreg bfc ggg, fe

to run a fixed effect model. The xtreg command is the regression command in panel data context and fe is just fixed effect.

If you just want to run a regression of y on x, w, and a categorical variable (such as provinces) you can generate a bunch of dummies automatically using:

xi: reg y x i.prov

this would generate 9 dummies and run the regression.

For more commands on panel data, students can look for them under the statistics thumb and then look for longitudinal/panel data. I saw that you can run IV (instrumental variables) easily. The command can be found in longitudinal/panel data---endogenous covariates. Students will have to play around with the GUI to find more commands. This is usually the way I do it when I don't know a command. I think the GUI is helpful for that.