Hello,
I have a problem with merging two datasets.
My main dataset consists of trade data, with the variables year, partneriso, reporteriso and further variables with 22,433 observations
The other data set contains of reporteriso, partneriso and distcap with 448 observations
My problem now is that i want to merge the second dataset into the first one, but i tried different combinations of merge 1:1, 1:m or m:1 but i couldn't get. I mostly got that the distance will only be merged for one pair of partneriso and reporteriso but not for all other observations.
My code looks like that:
sort partneriso reporteriso
merge m:m partneriso reporteriso using "...", keep( master match)
If I do that I only match if reporteriso and partneriso are "BEN" and "GIN" but for all other combinations i don't get any value.
How do i get that the distance will be merged for every combination of partneriso and reporteriso?
Thank you in advance for the help. Martin
I have a problem with merging two datasets.
My main dataset consists of trade data, with the variables year, partneriso, reporteriso and further variables with 22,433 observations
Code:
1992 "ZAF" "BEN" 1992 "NLD" "BEN" 1992 "DEU" "BEN" 1992 "IDN" "BEN" 1992 "THA" "BEN" 1992 "NLD" "BEN" 1992 "ESP" "BEN" ... 1992 "IDN" "GIN" 1992 "BRN" "GIN" 1992 "FIN" "GIN" 1992 "PRY" "GIN" 1992 "PRT" "GIN" 1992 "NLD" "GIN" 1992 "USA" "GIN"
Code:
"BEN" "ABW" 8006.697 "GIN" "ABW" 5940.813 "BEN" "AFG" 7450.474 "GIN" "AFG" 8955.442 "BEN" "AGO" 2064.176 "GIN" "AGO" 3804.649 "BEN" "AIA" 7242.226 "GIN" "AIA" 5192.66 "BEN" "ALB" 4228.5376 "GIN" "ALB" 4965.696
My code looks like that:
sort partneriso reporteriso
merge m:m partneriso reporteriso using "...", keep( master match)
If I do that I only match if reporteriso and partneriso are "BEN" and "GIN" but for all other combinations i don't get any value.
How do i get that the distance will be merged for every combination of partneriso and reporteriso?
Thank you in advance for the help. Martin
Comment