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]

Re: st: merge strategy


From   Sergiy Radyakin <[email protected]>
To   [email protected]
Subject   Re: st: merge strategy
Date   Wed, 19 Jan 2011 15:06:13 -0500

On Wed, Jan 19, 2011 at 2:52 PM, Dimitri Szerman <[email protected]> wrote:
> Hello,
>
> I'm merging two data sets on a varlist -- say v1 v2 v3. Sometimes
> there's a mismatch because of a problem in v3, so for a given v1 v2 v3
> I might end up with, say, 5 observation with _merge==3; 1 observation
> with _merge==1; and 1 observation with _merge==2. *I know* that the
> two unmatched observation should actually match -- in one of the
> datasets, there was a problem in v3. Any ideas on how to correct this
> in a concise and robust way?

I hope one of the three suggestions here actually fits your question,
as I don't clearly
understand your situation:

1) if matches for any record in v1 are contained either in v2 or in
v3, you can append v3
to v2 and merge v1 with the product of the append operation.

2) if the id is miscoded in one of the datasets and you know how to correct it,
match the two datasets that are supposed to match, review non-matches and
correct the ids.

3) if you have just one observation in each pair of the datasets you
can assign them the
same value of id before matching, but I don't see how you can
generalize this for
the (presumably possible) case when you have two or more cases of non-matches.

Best, Sergiy


>
> Many thanks,
> Dimitri
> *
> *   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