I try to destring two variables. One of them is the column for my cross-sectional units and the other is for my observations. They are different counties over a period of time, e.g. “CountyX2006”, “CountyY2007” etc.
I can’t understand why there are nonnumeric characters in these variables.
I tried running:
destring observation, replace
But Stata returns “observation contains nonnumeric characters; no replace”
Any ideas how to solve this problem? I've never encountered it before.
The reason I want to destring is is in order to use the command "xtset" that requires a numeric identifier.
EDIT
I think I solved this now. I encoded the counties, using:
"encode county, gen(county1)"
and used county1 in xtset instead
I can’t understand why there are nonnumeric characters in these variables.
I tried running:
destring observation, replace
But Stata returns “observation contains nonnumeric characters; no replace”
Any ideas how to solve this problem? I've never encountered it before.
The reason I want to destring is is in order to use the command "xtset" that requires a numeric identifier.
EDIT
I think I solved this now. I encoded the counties, using:
"encode county, gen(county1)"
and used county1 in xtset instead
Comment