I have panel data with a string variable for state and a numeric variable for year. I'd like to run a regression consisting of my outcome (v) and each year and state in the data set.
I've tried
regress v i.year i.state
but it doesn't work since stata can't factor a string variable. I then tried using tab state, generate(state) but that left me with a series of dummy variables of state1, state2, state3, state4, etc. rather than having each dummy variable labeled with the state name. Is there a way I can accomplish something equivalent to i. in the context of a regression for a string variable so I can get something similar to the output I achieve with i.year?
I've tried
regress v i.year i.state
but it doesn't work since stata can't factor a string variable. I then tried using tab state, generate(state) but that left me with a series of dummy variables of state1, state2, state3, state4, etc. rather than having each dummy variable labeled with the state name. Is there a way I can accomplish something equivalent to i. in the context of a regression for a string variable so I can get something similar to the output I achieve with i.year?
Comment