Standardized country names in Stata and merge

#1
Hi all,
I am currently attempting to merge different data sets in Stata. I have used the 'user written program' Kountry to standardize all my country names. And have used the kountryadd syntax to ensure that across all data sets, the variations of spellings are the same. However, when I attempt to merge data sets on both the standardized country name and the year, the data set merges but only some of the observations merge completely. The rest share the same unique id (i.e. standardized country name), in the newly merged data set, but are treated as separate observations.
For example:
id year var1 var 2
'USA' 1995 2 3
'USA' 1996 5 -
'USA' 1996 - 4
Any ideas as to why this is occurring? and suggestions to remedy this would be greatly appreciated.
Many thanks Leon
 

maartenbuis

TS Contributor
#2
It is very hard to say. It could be that the country names look similar but are not, e.g. there are spaces at the end in one file but not the other. Alternatively, you could inadvertedly have merged on the old unstandardized country names rather than the new ones. There is no way we could know that without seeing your exact code and your data.

My advise would be to take a brake and do something else. Such things are often a lot easier to spot with a fresh pair of eyes.