Merge multiple (imputed) datasets
mimerge [varlist] using filename-prefix [, keep(varlist) unique uniqmaster uniqusing nolabel nokeep _merge(varname)]
mimerge joins corresponding observations from each of the miset datasets with each of the using datasets into single observations.
keep(varlist) specifies the variables to be kept from the using data. If keep() is not specified, all variables are kept.
unique, uniqmaster, and uniqusing specify that the match variable(s) in a match merge uniquely identifies the observations.
unique specifies that the match variable(s) uniquely identifies the observations in the master data and in the using data. For most match merges, you should specify unique. merge does nothing differently when you specify the option, unless the assumption that you are making is false. In that case, an error message is issued and the data are not merged.
uniqmaster specifies that the match variable(s) uniquely identifies the observations in memory, the master data, but not necessarily the ones in the using data.
uniqusing specifies that the match variable(s) uniquely identifies the observations in the using data, but not necessarily the ones in the master data.
nolabel prevents Stata from copying the value label definitions from the using dataset.
nokeep causes merge to ignore observations in the using data that have no corresponding observation in the master.
_merge(varname) specifies the name of the variable that will mark the source of the resulting observation. The default is _merge(_merge).
These options are all inherited from the parent merge command.
The master datasets should be miset before using mimerge. The number of using datasets must be the same as that of the master datasets. The names follow mi naming conventions, see help miset.
Assume foo1.dta to foo5.dta have variables id and drkfre, and bar1.dta to bar5.dta have variables id and smk. By issuing
. miset using foo . mido sort id . misave foo, replace . miset using bar . mido sort id . mimerge id using foo . misave foobar
the dataset foom.dta is merged to barm.dta to form a new dataset foobarm.dta (m = 1,...,5), which contains variables id, drkfre, and smk.
Ning Li, Philip Greenwood, and John Carlin, Clinical Epidemiology & Biostatistics Unit, Murdoch Children's Research Institute and University of Melbourne. Email email@example.com
Online: help for merge, miset, miappend, misave, mido, mici, mifit, milincom, mireset