I am trying to the merge two datasets that have unemployment rates from different sources, and the first is structured as below:
It has over 30 variables but I am only listing this as an example. In addition, each observation is measured at one year only, for Egypt it is 2005.
year country Gender Unemployment
2005 EGY Female 7.6
2005 EGY Male 9.2
2005 EGY Total .
2006 EGY Female 7.6
2006 EGY Male 9
2006 EGY Total .
The second is structured as below, but it comes from an annual survey, so each country has three entries per year (total, male, female). And each country has from 1995-2019.
country Gender year Unemployment
EGY Total 2005 12
EGY Male 2005 7
EGY Female 2005 17.5
Therefore, I tried to merge the two datasets with 1:1 and 1:m merge, and for both I get:
"variables country year do not uniquely identify observations in the master data"
However, the merge worked with a m:m as in below,
merge m:m country year using "DocumentsLMI.dta"
Thanks to Nick's advice, I merged with the triples:
merge 1:1 country year Gender cusing "DocumentsLMI.dta"
And it worked well!
question from:
https://stackoverflow.com/questions/65941898/problems-with-an-mm-merge-stata 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…