Stata code for linear regression that controls for state effects Someone told me I should put a variable in my regression to see the state effects. (States in the United States) So he wrote this code and said to put in my variables where the ... is.

xi: reg ... i.STATE, robust


(The robust is because the data is heteroskedastic)

So here's what it is with the variables:

sust_all form_type_dum EDUCPAY HAZARDPAY SHIFTPAY SKILLPAY MILPAY COLLBARG RESPAY CHIEFMAX  OPBUDGET OPBUDGEST POPULATION i.STATE, robust


But I'm getting an error in Stata:

invalid syntax


What am I writing wrong? Or is there a better way to see state effects? Can I just leave that out of the regression?

Background

I'm doing a regression on data from 2007 where the dependent variable is number of sustained complaints per 10 officers in a police department. I want to see if any variables about pay or department budget will explain it. The data comes from Law Enforcement Management and Administrative Statistics (LEMAS), 2007. The survey is administered by the US Department of Justice. The STATE variable is the state where the agency is based out of.
Here's a guess about what has gone wrong, since what you wrote down will get you a different error message.

I would bet dollars to donuts that you left out the the reg (short for regress) from:  

xi: reg sust_all form_type_dum EDUCPAY HAZARDPAY SHIFTPAY SKILLPAY MILPAY COLLBARG RESPAY CHIEFMAX  OPBUDGET OPBUDGEST POPULATION i.STATE, robust


Also, unless your version of Stata is ancient, you don't need xi:, so just type:

reg sust_all form_type_dum EDUCPAY HAZARDPAY SHIFTPAY SKILLPAY MILPAY COLLBARG RESPAY CHIEFMAX  OPBUDGET OPBUDGEST POPULATION i.STATE, robust


Stata will handle the state FEs for you.