Open ManytoMany left.dta 

Open ManytoMany right.dta

ManytoMany left.dta preview

ManytoMany right.dta preview

The “merge” command does not produce the correct results for a many to many merge.

Merge using the “joinby” command.

* Import the left dataset, referred to as the “master” dataset

use "ManytoMany left", replace

* Merge the right dataset, referred to as the “using” dataset on the unique identifier Key

joinby Key using "ManytoMany right.dta", unmatched(both)

Example data

Functions referenced:

use

joinby

--- The End ---