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: strange merge report


From   "Gregory, Christian" <cgregory@ers.usda.gov>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: strange merge report
Date   Wed, 17 Nov 2010 09:53:26 -0500

Stata Colleagues,

I'm getting a strange merge report when I merge two datasets that I'm using. One data set has regional variables; the other is the CPS. The merge report says that none of the observations have been merged, but when I tabulate _merge, it shows that all of observations have been matched. Additionally, a check of the existence and means of the merge variables confirms that they are not in the data set before the merge, and they are after the merge.

In what follows, the CPS is the master data.

One version of the report is:

------------------
sort geogroup year
capture drop _merge
merge m:1 geogroup year using geodata 

    Result                           # of obs.
    -----------------------------------------
    not matched                             0
    matched                                 0  (_merge==3)
    -----------------------------------------

. tab _merge      

                 _merge |      Freq.     Percent        Cum.
------------------------+-----------------------------------
            matched (3) |     92,234      100.00      100.00
------------------------+-----------------------------------
                  Total |     92,234      100.00


----------------------------

Another version is 

-------------------------------
sort geogroup year
capture drop _merge
merge m:1 geogroup year using geodata 



    Result                           # of obs.
    -----------------------------------------
    not matched                             .
        from master                         .  (_merge==1)
        from using                          .  (_merge==2)

    matched                                 .  (_merge==3)
    -----------------------------------------

. tab _merge      

                 _merge |      Freq.     Percent        Cum.
------------------------+-----------------------------------
            matched (3) |     92,234      100.00      100.00
------------------------+-----------------------------------
                  Total |     92,234      100.00


--------------------------------------------


The practical effect of this is unclear: my estimates do vary a little from iteration to iteration, and I suspect this has something to do with this report.

Any help would be most appreciated.

Christian A. Gregory
Research Economist
Economic Research Service, USDA
1800 M. St. NW, Room S2095
Washington, DC 20036
202-694-5132


Christian A. Gregory
Research Economist
Economic Research Service, USDA
1800 M. St. NW, Room S2095
Washington, DC 20036
202-694-5132



*
*   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