For example, I can see (in year = 2000) that when county = Springfield, City = Pine Bluff, and state = AR, then that id variable should be 432. Or when id is 756, then county should be Santa Cruz and city should be Santa Cruz. I have a very large dataset with many of these types of missings, but I'm hoping that this backfill-by-matching technique will mostly work. But my attempts so far at doing this succinctly have failed. Thanks so much for your help!
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int id str11 county int year str10 city str2 state 432 "Springfield" 2000 "Pine Bluff" "AR" . "Springfield" 1999 "Pine Bluff" "AR" 756 "Santa Cruz" 2000 "Santa Cruz" "CA" 756 "" 1999 "" "CA" 756 "" 1998 "" "CA" 193 "Union" 2000 "Union City" "NJ" . "Union" 1996 "Union City" "NJ" 193 "" 1999 "Union City" "NJ" end
0 Response to Using matching variable to fill in other variables
Post a Comment