Hi All,
I am trying to run a panel data regression using the xtset command but am facing 2 problems. I have 5 years of monthly data, hence my dataset includes the variable 'Year' and 'Month'.
this is what i used:
xtset Company Year Month
1. May I know if there is a way to use xtset with both the year and month variables? From the manual, it seems like xtset only allows 1 panel id and 1 time variable.
I thought of combining the year and month variables into 1 variable e.g. Date but I was hoping to control for both year and month fixed effects.
Because of problem 1, I changed to command as such:
xtset Company Date
2. My panel variable is a string variable which contains both numerics and letters.
When I tried to use that as my panel variable, Stata gives an error message "string variables not allowed".
varlist: CompanyName: string variable not allowed
I tried to destring it by using "destring Company, generate (company)"
another error occurred "Company contains nonnumeric characters; no generate"
a similar error message occurs if I try to use "destring Company, replace"
Could someone kindly advise me on the 2 problems above? Thank you very much.
I am trying to run a panel data regression using the xtset command but am facing 2 problems. I have 5 years of monthly data, hence my dataset includes the variable 'Year' and 'Month'.
this is what i used:
xtset Company Year Month
1. May I know if there is a way to use xtset with both the year and month variables? From the manual, it seems like xtset only allows 1 panel id and 1 time variable.
I thought of combining the year and month variables into 1 variable e.g. Date but I was hoping to control for both year and month fixed effects.
Because of problem 1, I changed to command as such:
xtset Company Date
2. My panel variable is a string variable which contains both numerics and letters.
When I tried to use that as my panel variable, Stata gives an error message "string variables not allowed".
varlist: CompanyName: string variable not allowed
I tried to destring it by using "destring Company, generate (company)"
another error occurred "Company contains nonnumeric characters; no generate"
a similar error message occurs if I try to use "destring Company, replace"
Could someone kindly advise me on the 2 problems above? Thank you very much.
Comment