I have a panel of census tracts, where each is identified by an 11-digit GEOID. I would like to run a regression with fixed effects, e.g.,
However, I get the following error message:
This is strange, as all GEOIDs are integers in the mathematical sense. I believe the error occurs because Stata restricts the integer data type to [–32767, 32740]. Regardless, I can circumvent the issue with the following trick:
This solution, however, causes issues when working with R and Python. Namely, the -geoid- value label is ignored, and the arbitrary integer values are used instead. Thus arises my question: Does anyone have a better solution? Thanks in advance!
Code:
reg y X i.geoid
Code:
geoid: factor variables may not contain noninteger values
Code:
tostring geoid, gen(temp) format("%011.0f") encode temp, gen(geoid2) drop id geoid ren geoid2 geoid xtset geoid year, yearly
Comment