Hi all,
I'm new to Stata and I haven't been able to include time-varying country fixed effects (a dummy for each country-year pair). Also, I need to cluster errors at the Country_Year level. I have tried with the next piece of code
encode Country, gen (Countries)
egen CountryD = group (Countries)
egen YearD = group (Year)
egen Country_Year = group (CountryD YearD)
xtset Countries Country_Year
xtline Y
xtline Y , overlay
xtreg Y X1 X2 X3 X4 i.Country_Year, fe vce(cluster Country_Year)
The error message that I get after running it is "panels are not nested within clusters".
Could you please tell me how to fix this problem? I'd really appreciate it.
I'm new to Stata and I haven't been able to include time-varying country fixed effects (a dummy for each country-year pair). Also, I need to cluster errors at the Country_Year level. I have tried with the next piece of code
encode Country, gen (Countries)
egen CountryD = group (Countries)
egen YearD = group (Year)
egen Country_Year = group (CountryD YearD)
xtset Countries Country_Year
xtline Y
xtline Y , overlay
xtreg Y X1 X2 X3 X4 i.Country_Year, fe vce(cluster Country_Year)
The error message that I get after running it is "panels are not nested within clusters".
Could you please tell me how to fix this problem? I'd really appreciate it.
Comment