I have the following variables countyname and countynamegini, I want to match each observation in countyname with that in countynamegini. For example I want to keep the observations Baldwin AL and Calhon in the variable countyname and drop the other observations that can be seen in the sample code below. How would I do this? I tried running a loop but I got an error due to wrong syntax
[CODE]
* Example generated by -dataex-. To install: ssc install dataex
clear
input str29 countyname str42 countynamegini
"UNITED STATES" "Baldwin County, Alabama"
"ALABAMA" "Calhoun County, Alabama"
"Autauga, AL" "Cullman County, Alabama"
"Baldwin, AL" "DeKalb County, Alabama"
"Barbour, AL" "Elmore County, Alabama"
"Bibb, AL" "Etowah County, Alabama"
"Blount, AL" "Houston County, Alabama"
"Bullock, AL" "Jefferson County, Alabama"
"Butler, AL" "Lauderdale County, Alabama"
"Calhoun, AL" "Lee County, Alabama"
[CODE]
* Example generated by -dataex-. To install: ssc install dataex
clear
input str29 countyname str42 countynamegini
"UNITED STATES" "Baldwin County, Alabama"
"ALABAMA" "Calhoun County, Alabama"
"Autauga, AL" "Cullman County, Alabama"
"Baldwin, AL" "DeKalb County, Alabama"
"Barbour, AL" "Elmore County, Alabama"
"Bibb, AL" "Etowah County, Alabama"
"Blount, AL" "Houston County, Alabama"
"Bullock, AL" "Jefferson County, Alabama"
"Butler, AL" "Lauderdale County, Alabama"
"Calhoun, AL" "Lee County, Alabama"
Comment