I have an unbalanced panel data set with more than 400,000 observations over 20 years. My panel variable is a person id and my time series variable is the year. The persons are from all over Germany which means that they are from different regions. To account for possible correlations between the persons within the same regions, I would like use clustered standard errors in my fixed effects regression. The Stata code looks like this:
xtreg depvar var1 var2 ... varN if year > 1990, fe vce(cluster clustvar)
First, I used the variable "region" which is a numeric variable indicating in which region the observation (person) lives as the cluster variable (clustvar). Of course, I got the error "panels are not nested within clusters" because I forgot that people move across regions such that they appear in more than a single region. To fix this problem, I wanted to use a region-year variable which is a numeric variable indicating the year as well as the region. To visualize the variable, the follwing extract from my dataset including the variable "region-year" may help:
region year region-year
1 1991 2000
1 1992 3000
2 1991 2500
2 1992 3500
2 1993 4500
Note that this extract does not contain the person id. The values of "region-year" are chosen arbitrarily in this example. In my opinion, it is just important that all observations belonging to the same region in the same year have the same number no matter how this number looks like. Am I right? Running the regression
xtreg depvar var1 var2 ... varN if year > 1990, fe vce(cluster region-year)
also causes the error "panels are not nested within clusters". But I don't know why.