Abstract
Stata tip 142: joinby is the real merge m:m
Highlights
The merge command is one of Stata’s most used commands and works fine as long as the match key is unique in one of the datasets
When the match key contains duplicates in either dataset, Stata gives an error message saying that the key variable(s) do not uniquely identify observations in master or using dataset
The merge 1:1 shows that John Smith is a baker and Jane Smith is a lawyer
Summary
The merge command is one of Stata’s most used commands and works fine as long as the match key is unique in one of the datasets (that is, merge 1:1, 1:m, or m:1 situations). When the match key contains duplicates in either dataset, Stata gives an error message saying that the key variable(s) do not uniquely identify observations in master or using dataset. The first individual is a baker, and the second individual is a lawyer. The first and last names of each individual are included in names.dta
Talk to us
Join us for a 30 min session where you can share your feedback and ask us any queries you have
More From: The Stata Journal: Promoting communications on statistics and Stata
Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.