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   Michael Betz <[email protected]>
To   "[email protected]" <[email protected]>
Subject   RE: st: Merge question
Date   Wed, 15 May 2013 20:23:29 +0000

It was char 160. Thanks for the help!

Mike

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Nick Cox
Sent: Wednesday, May 15, 2013 4:01 PM
To: [email protected]
Subject: Re: st: Merge question

Check for trailing spaces and for char 160 (looks like a space, but isn't).

replace county = subinstr(county, "`= char(160)'", " ", .)

-charlist- from SSC may help.

Nick
[email protected]


On 15 May 2013 20:53, 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/

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



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