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: Re: Merge problem; missing observation


From   Phil Clayton <[email protected]>
To   [email protected]
Subject   Re: st: Re: Merge problem; missing observation
Date   Fri, 10 Feb 2012 08:48:54 +1100

It looks like one of the observations has a different value for snp in the master and using dataset.

Your command:
merge m:1 snp using fileB, assert(match master) keep(match)

tells -merge- only to keep observations that are matched. Your job is therefore to find the observation in each dataset with the unmatched snp.

Try:
merge 1:1 snp using fileB

Then have a look at the _merge variable to see which observations are causing the problem.

Phil

On 10/02/2012, at 8:27 AM, Shubhabrata Mukherjee wrote:

> 
> Hi Nick,
> 
>    I get the same result when I use a 1:1 merge.
> 
> Thanks,
> 
>  -Joey
> 
> 
> 
> 
> ----- Original Message -----
> From: Shubhabrata Mukherjee <[email protected]>
> To: stata forum <[email protected]>
> Cc: 
> Sent: Thursday, February 9, 2012 12:45 PM
> Subject: Merge problem; missing observation
> 
> Hi,
> 
>   I have two files with the same # of observations but when I try to merge them somehow the merged dataset has one less observation. I checked that there was no observations which was dropped. What am I dong wrong here?
> 
> Thanks,
> 
>  -Joey
> 
> E.g.
> 
> #############
> 
>  File A
> 
> duplicates report snp
> 
> --------------------------------------
>    copies | observations       surplus
> ----------+---------------------------
>         1 |       691677             0
> --------------------------------------
> 
> 
> #############
> 
>  File B
> 
> 
> duplicates report snp
> 
> --------------------------------------
>    copies | observations       surplus
> ----------+---------------------------
>         1 |       691677             0
> --------------------------------------
> 
> #####################
> merge file A with file B
> 
> merge m:1 snp using fileB, assert(match master) keep(match)
> 
>    Result                           # of obs.
>     -----------------------------------------
>     not matched                             0
>     matched                           691,676  (_merge==3)
>     -----------------------------------------
> 
> 
> *
> *   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