Below shows the imported Stata data of the county adjacency file (.txt).
For each 'county_name' and 'county_id', it shows the list of 'neighbor_county' and 'neighbor_county_id'.
I would like to reconstruct the data format so that for each county has 'neighbor_county1', 'neighbor_county1_id', 'neighbor_county2', 'neighbor_county2_id' ... etc.
So instead of having a list, I would like to have a long sequence of neighboring counties.
I tried to use - order = _n - but the missings for 'county_name' create some problem.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str37 county_name long county_id str37 neighbor_county long neighbor_county_id "Autauga County, AL" 1001 "Autauga County, AL" 1001 "" . "Chilton County, AL" 1021 "" . "Dallas County, AL" 1047 "" . "Elmore County, AL" 1051 "" . "Lowndes County, AL" 1085 "" . "Montgomery County, AL" 1101 "Baldwin County, AL" 1003 "Baldwin County, AL" 1003 "" . "Clarke County, AL" 1025 "" . "Escambia County, AL" 1053 "" . "Mobile County, AL" 1097 "" . "Monroe County, AL" 1099 "" . "Washington County, AL" 1129 "" . "Escambia County, FL" 12033 "Barbour County, AL" 1005 "Barbour County, AL" 1005 "" . "Bullock County, AL" 1011 "" . "Dale County, AL" 1045 "" . "Henry County, AL" 1067 "" . "Pike County, AL" 1109 "" . "Russell County, AL" 1113 "" . "Clay County, GA" 13061 "" . "Quitman County, GA" 13239 "" . "Stewart County, GA" 13259 end
0 Response to Reconstruct data format for county adjacency
Post a Comment