Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: vexing m:m merge


From   "Sarah Edgington" <[email protected]>
To   <[email protected]>
Subject   st: RE: vexing m:m merge
Date   Wed, 23 Feb 2011 10:36:37 -0800

.
If you're merging many to many that means that you have multiple
observations with a given value of X1 in each file.  If there are more
observations with a given X1 in your using file than your master file, then
you'll end up with a larger final file than before since they match across
both files.  If this isn't  the behavior you're expecting that suggests that
maybe you want to think through your match criteria more carefully and make
sure that there isn't some other variable that you also want to use for
matching.
-Sarah

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Lloyd Dumont
Sent: Wednesday, February 23, 2011 10:26 AM
To: [email protected]
Subject: st: vexing m:m merge

This has to be obvious...

If I am running a many to many merge keeping only observations in the master
and those that match the using, then how could the merge be generating new
observations in the master?

More succinctly, I am inputting...

. merge m:m X1 using "usingfile.dta", keep(master match) keepusing(X2)

Before the merge, n = 1061.  After the merge, n = 1077.

I tried to troubleshoot by generating a TAG variable and setting it to one,
but after the merge, every observation--even the new ones--have TAG = 1.

Thank you for your thoughts/help.  Lloyd


      
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index