Dear all,
I am dealing with mismatched country codes. One dataset has countries given numbers (Global Terrorism Database) while the other gives countries codes (World Development Indicators, e.g., AFG). I have encoded the latter's country codes and then am going through and am changing them to match the GTD's country codes country-by-country. This means that my DO file currently looks like the following, where "ctry" is the encoded WDI country-code variable and "country" is the new GTD country-numbers variable.
This repeats for 190 lines. I was wondering if there was a more concise way to do this? I understand if there is not, considering each pair is unique - no one country variable in either shares a number.
Many thanks!
I am dealing with mismatched country codes. One dataset has countries given numbers (Global Terrorism Database) while the other gives countries codes (World Development Indicators, e.g., AFG). I have encoded the latter's country codes and then am going through and am changing them to match the GTD's country codes country-by-country. This means that my DO file currently looks like the following, where "ctry" is the encoded WDI country-code variable and "country" is the new GTD country-numbers variable.
Code:
replace country=4 if ctry==3 replace country=5 if ctry==6 replace country=6 if ctry==61 replace country=8 if ctry==5 replace country=10 if ctry==13 replace country=11 if ctry==10 replace country=12 if ctry==11 replace country=17 if ctry==24 replace country=18 if ctry==23 replace country=19 if ctry==21 replace country=20 if ctry==31 replace country=35 if ctry==26 replace country=21 if ctry==18 replace country=22 if ctry==27 replace country=23 if ctry==19 replace country=24 if ctry==28 replace country=25 if ctry==33 replace country=26 if ctry==29 replace country=28 if ctry==25 replace country=29 if ctry==34 replace country=31 if ctry==32 replace country=32 if ctry==22 replace country=33 if ctry==20 replace country=34 if ctry==17 replace country=36 if ctry==124 replace country=37 if ctry==43 replace country=38 if ctry==36 replace country=41 if ctry==35
Many thanks!
Comment