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 unmerged observations
From
Lara Loewenstein <[email protected]>
To
[email protected]
Subject
st: Nearmrg deleting unmerged observations
Date
Fri, 12 Jul 2013 10:50:07 -0400
I'm using nearmrg to merge two datasets by street address. But I want
an approximate merge for the street number while an exact merge for
the street name. I also have multiple cities in the master dataset,
while only one city in the using dataset, so I want to merge in the
using dataset for that one city while keeping the unmerged
observations in the master dataset. My code looks like this:
nearmrg street city using "UsingData", nearvar(stnum) limit(10)
genmatch(using_stnum) update
The problem is, that when I do this, nearmrg automatically deletes all
the unmerged data, so all i'm left with is a subset of the city in the
using dataset that managed to merge with the master data.
How do I get nearmrg to keep all the observations, both merged and
unmerged? I tried adding the keep option from the standard merge
command, adding keep(1/5) since I'm updating a variable as well, but
that caused nearmrg to delete all the observations and left me with an
empty dataset.
Many thanks.
Lara Loewenstein
*
* 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/