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: Merge question


From   William Sankey <[email protected]>
To   [email protected]
Subject   Re: st: Merge question
Date   Wed, 15 May 2013 14:59:21 -0500

Hi Mike,

Do you know how those counties were placed into the dataset? Usually
when merging on string variable I'm very careful to ensure I don't
have extra spaces or discrepancies between upper and lower cases. I'm
betting you have extra spaces on those string variables and that's
whats causing the incomplete merge.

Best,
Will

On Wed, May 15, 2013 at 2:53 PM, Michael Betz
<[email protected]> wrote:
> Hi all--I'm having a confusing merge issue. I'm merging on string variables "state" and "county". It works for 99% of the observations, but is having trouble with the counties that begin with "ST". As you can see below, there are what appear to be identical observations that are categorized as "using only" or "master only", though they should be matched. I can't figure out what is stopping them from merging. If I execute count if county=="ST CLAIR", Stata only returns 4, when I would expect 8. Here is my code and part of the resulting merged dataset:
>
> merge 1:1 state county using "stco fips"
>
> county          state   totaloasdi      disabledworkers fipsstate
> ST CHARLES      MO                      29      183     using only (2)
> ST CHARLES      LA                      22      089     using only (2)
> ST CLAIR        IL                      17      163     using only (2)
> ST CLAIR        MI                      26      147     using only (2)
> ST CLAIR        MO                      29      185     using only (2)
> ST CLAIR        AL                      01      115     using only (2)
> ST CROIX        WI                      55      109     using only (2)
> ST FRANCIS      AR                      05      123     using only (2)
> ST FRANCOIS     MO                      29      187     using only (2)
> ST CHARLES      LA      6317    795                     master only (1)
> ST CHARLES      MO      35290   3645                    master only (1)
> ST CLAIR        AL      10905   1810                    master only (1)
> ST CLAIR        IL      43120   4965                    master only (1)
> ST CLAIR        MO      2721    410                     master only (1)
> ST CLAIR        MI      27015   2870                    master only (1)
> ST CROIX        VI      6879    670                     master only (1)
> ST FRANCIS      AR      5146    735                     master only (1)
> ST FRANCOIS     MO      12406   2040                    master only (1)
>
> Thanks,
> Mike
>
> *
> *   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/



-- 
William J. Sankey
Johns Hopkins University
MA Public Policy '12

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