Hi everyone!
I have the following two datasets:
input country year var1
1 2011 0.6
1 2012 0.5
1 2015 0.4
end
input country year var2
1 2012 30
1 2013 28
1 2014 22
end
I wish to combine them to get
input country year var1 var2
1 2011 0.6 .
1 2012 0.5 30
1 2013 . 28
1 2014 . 22
1 2015 0.4 .
end
I tried
merge m:m country year using merge_try2_MPI.dta
It works fine with the above two small datasets.
But I read in Baum (2009)'s "An Introduction to Stata Programming" that "A many-to-many merge has no unique outcome ... To quota the Stata Data Management Refernce Manual:' Because m:m merges are such a bad idea, we are not going to show you an example' " (p. 116-7).
And my actual datasets are large. I wonder how I can combine them in the above fashion properly, if not using m:m merge?
Many thanks to your help!!
I have the following two datasets:
input country year var1
1 2011 0.6
1 2012 0.5
1 2015 0.4
end
input country year var2
1 2012 30
1 2013 28
1 2014 22
end
I wish to combine them to get
input country year var1 var2
1 2011 0.6 .
1 2012 0.5 30
1 2013 . 28
1 2014 . 22
1 2015 0.4 .
end
I tried
merge m:m country year using merge_try2_MPI.dta
It works fine with the above two small datasets.
But I read in Baum (2009)'s "An Introduction to Stata Programming" that "A many-to-many merge has no unique outcome ... To quota the Stata Data Management Refernce Manual:' Because m:m merges are such a bad idea, we are not going to show you an example' " (p. 116-7).
And my actual datasets are large. I wonder how I can combine them in the above fashion properly, if not using m:m merge?
Many thanks to your help!!


Comment