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: Nearmrg deleting merged observations


From   Jaclene Begley <[email protected]>
To   [email protected]
Subject   st: Nearmrg deleting merged observations
Date   Thu, 13 Mar 2014 19:04:09 -0400

I'm using nearmrg in Stata 12.1 to merge two datasets by date,
location, and name, with a fuzzy match on the date variable. I
understand that nearmrg by default drops all unmatched observations,
but it appears that the final dataset has also deleted some of the
matched observations.

As shown in the output below - the results display 95,324 _merge == 3
observations, but the final dataset only contains 75,446 _merge == 3
observations.

Does anyone know if there is there a way to: prevent observations from
being dropped from the final output/ or to figure out why these
matched observations were dropped ?

Many thanks,
Jackie Begley

***********************************;
. use datax, clear;

. sort locate date name;

. nearmrg locate name using `datay', nearvar(date) limit(30)
genmatch(m_date) type(1:1);

file /tmp/100692.1.sta.q/St18317.00000c saved
(1936156 missing values generated)
(1936156 missing values generated)
(80882 real changes made)
(21860 real changes made)
0
(1840832 missing values generated)
(1590403 observations deleted)
file /tmp/100692.1.sta.q/St18317.00000c saved

    Result                           # of obs.
    -----------------------------------------
    not matched                             0
    matched                         1,936,156  (__000003==3)
    -----------------------------------------

    Result                           # of obs.
-----------------------------------------
    not matched                     3,340,605
        from master                 1,840,832  (_merge==1)
        from using                  1,499,773  (_merge==2)

    matched                            95,324  (_merge==3)
    -----------------------------------------
(3340605 missing values generated)
(3360483 observations deleted)

count;
75446

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


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