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


From   Austin Nichols <[email protected]>
To   [email protected]
Subject   Re: st: Nearmrg deleting unmerged observations
Date   Fri, 12 Jul 2013 12:52:19 -0400

Lara Loewenstein <[email protected]>:
Without more info, this seems like a bad idea--seems likely you want
the nearest address, which need not be an exact match on street name
and fuzzy on number. You should geocode the data and match the nearest
address using distance in miles/km, no? Plus that way you will get the
right matches in:

1140 Conn. Ave
11400 Connecticut Ave
1140 Connecticut Ave

but your approach would match 2 and 3 above, right?

On Fri, Jul 12, 2013 at 10:50 AM, Lara Loewenstein <[email protected]> wrote:
> 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.
*
*   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