I am running into a problem with some code. I am writing a policy diffusion paper and need to create a variable that codes neighboring states 1 (0 if not a neighboring state). Someone (thankfully) has already done this, however I keep getting a r(198) error when I attempt to use it. A data example is below:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input long state_abbrv float state_fips long state_name str2 stateabbr str20 statename 2 1 1 "AL" "Alabama" 2 1 1 "AL" "Alabama" 2 1 1 "AL" "Alabama" 2 1 1 "AL" "Alabama" 2 1 1 "AL" "Alabama" 2 1 1 "AL" "Alabama" 2 1 1 "AL" "Alabama" 2 1 1 "AL" "Alabama" 2 1 1 "AL" "Alabama" 2 1 1 "AL" "Alabama" end label values state_abbrv state_abbrv label def state_abbrv 2 "AL", modify label values state_name statename label def statename 1 "Alabama", modify
Listed 10 out of 24900 observations
The code I'm using comes from this website: http://theincidentaleconomist.com/wo...th-stata-code/ (super helpful for this by the way). However, when I enter the code I get this error:
HTML Code:
. gen sAKn = inlist(stateabbr,”WA”) ”WA” invalid name r(198);
This happens even if I use the state_abbrv variable as well (although that's a long variable currently). I prefer using the state abbreviations because I don't know off the top of my head the state_fips code. Any assistance would be greatly appreciated.
0 Response to Neighboring States
Post a Comment