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: Re: Replacing Address Information in Panel Data Set


From   Matthew Krauchunas <[email protected]>
To   [email protected]
Subject   Re: st: Re: Replacing Address Information in Panel Data Set
Date   Tue, 13 Jul 2010 10:23:57 -0400

Hi Eric,

To get around this I cleared out the address information in the
masterfile and then just used the update option with the merge
command.  There is probably a better way, but this works at least!
Thanks again!

Matt

On Tue, Jul 13, 2010 at 8:04 AM, Matthew Krauchunas
<[email protected]> wrote:
> Hi Eric,
>
> I ran the code you provided below and the address portion worked
> great.  However, I received a "_merge
> nonmissing conflict (5)" under the Stata created merge variable.  I
> also noticed that Stata changed all the names to match.  For example,
> Emmmanuel Convalescent Hospital Alameda became Crown Bay Nursing and
> Rehab for all observations with osphd_fac_no 206010734.  I need the
> names to stay the same.  Here is the output so you can see
> specifically what I am talking about:
>
> oshpd_fac_no    year    facility_name   street_address  city    zip_code        state   _merge
> 206010736       2002    CROWN BAY NURSING AND REHAB     508 WESTLINE
> DRIVE   ALAMEDA 94501-5847      CA      nonmissing conflict (5)
> 206010736       2003    CROWN BAY NURSING AND REHAB     508 WESTLINE
> DRIVE   ALAMEDA 94501-5847      CA      nonmissing conflict (5)
> 206010736       2004    CROWN BAY NURSING AND REHAB     508 WESTLINE
> DRIVE   ALAMEDA 94501-5847      CA      nonmissing conflict (5)
> 206010736       2006    CROWN BAY NURSING AND REHAB     508 WESTLINE
> DRIVE   ALAMEDA 94501-5847      CA      nonmissing conflict (5)
> 206010736       2007    CROWN BAY NURSING AND REHAB     508 WESTLINE
> DRIVE   ALAMEDA 94501-5847      CA      nonmissing conflict (5)
> 206010736       2008    CROWN BAY NURSING AND REHAB     508 WESTLINE
> DRIVE   ALAMEDA 94501-5847      CA      nonmissing conflict (5)
> 206010752       2002    ASHBY CARE CENTER       2270 ASHBY
> AVENUE  BERKELEY        94705-1935      CA      nonmissing conflict (5)
> 206010752       2003    ASHBY CARE CENTER       2270 ASHBY
> AVENUE  BERKELEY        94705-1935      CA      nonmissing conflict (5)
> 206010752       2004    ASHBY CARE CENTER       2270 ASHBY
> AVENUE  BERKELEY        94705-1935      CA      nonmissing conflict (5)
> 206010752       2006    ASHBY CARE CENTER       2270 ASHBY
> AVENUE  BERKELEY        94705-1935      CA      nonmissing conflict (5)
> 206010752       2007    ASHBY CARE CENTER       2270 ASHBY
> AVENUE  BERKELEY        94705-1935      CA      nonmissing conflict (5)
> 206010752       2008    ASHBY CARE CENTER       2270 ASHBY
> AVENUE  BERKELEY        94705-1935      CA      nonmissing conflict (5)
>
> Is there a way to tell Stata to only replace certain variables?
>
> Thanks,
> Matt
>
>
> On Mon, Jul 12, 2010 at 11:27 PM, Eric Booth <[email protected]> wrote:
>> <>
>>
>> Use -merge- by the "oshpd_fac_no" with the update and replace options:
>>
>> *****************!
>> clear
>> inp oshpd_fac_no    year    str50 facility_name    str25(street_address    city)    zip_code
>> 206010734    2002    "EMMANUEL COMVALESCENT HOSPITAL ALAMEDA"    "508 WESTLINE DRIVE"    "ALAMEDA"    91011
>> 206010734    2003    "EMMANUEL CONVALESCENT HOSPITAL ALAMEDA"    "508 WESTLINE DRIVE"    "ALAMEDA"    91011
>> 206010734    2004    "EMMANUEL CONVELESCENT HOSPITAL ALAMEDA"     "508 WESTLINE DRIVE"     "ALAMEDA" 91011
>> 206010734    2006    "EMMANUEL CONVALESCENT HOSPITAL ALAMEDA"    "508 WESTLINE DRIVE"    "ALAMEDA"    91011
>> 206010734    2007    "CROWN BAY NURSING AND REHAB"    "508 WESTLINE DRIVE"    "ALAMEDA"    91342
>> 206010734    2008    "CROWN BAY NURSING AND REHAB"    "508 WESTLINE DRIVE"    "ALAMEDA"    91105
>> 206010744    2002    "ASHBY CARE CENTER"    "2270 ASHBY AVENUE"    "BERKELEY"    94115
>> 206010744    2003    "ASHBY CARE CENTER"    "2270 ASHBY AVENUE"    "BERKELEY"    96264
>> 206010744    2004    "ASHBY CARE CENTER"    "2270 ASHBY AVENUE"    "BERKELEY"    92626
>> 206010744    2006    "ASHBY CARE CENTER"    "2270 ASHBY AVENUE"    "BERKELEY"    90801
>> 206010744    2007    "ASHBY CARE CENTER"    "2270 ASHBY AVENUE"    "BERKELEY"    94705
>> 206010744    2008    "ASHBY CARE CENTER"    "2270 ASHBY AVENUE"    "BERKELEY"    94705
>> end
>> tostring oshpd, replace
>> tostring zip_code, replace
>> save master.dta, replace
>>
>>
>> **Address corrected file:
>> clear
>> inp oshpd_fac_no str50 facility_name str25(street_address city) str5 state str12 zip_code
>> 206010734 "CROWN BAY NURSING AND REHAB" "508 WESTLINE DRIVE" "ALAMEDA" "CA" "94501-5847"
>> 206010744 "ASHBY CARE CENTER" "2270 ASHBY AVENUE" "BERKELEY" "CA" "94705-1935"
>> end
>> tostring oshpd, replace
>> save using.dta, replace
>>
>> **Merge them together
>> u master.dta, clear
>> merge m:1 oshpd_fac_no using "using.dta", update replace   // <--using Stata 11 syntax
>> ta _m
>> *****************!
>>
>> ~ Eric
>> __
>> Eric A. Booth
>> Public Policy Research Institute
>> Texas A&M University
>> [email protected]
>> Office: +979.845.6754
>>
>>
>> On Jul 12, 2010, at 9:16 PM, Matthew Krauchunas wrote:
>>
>>>> Hello,
>>>>
>>>> I have panel data with consists of a facility number unique to each address, facility name, city, state, and zip code.  I took that information, collapsed it, performed an outsheet, had all of the addresses verified/corrected via an address verification program, insheeted the results back into Stata, and saved it under a new file name.  My challenge now is how to put my master file back together with the addresses that were just corrected.  Any ideas?
>>>>
>>>> Thank you!
>>>> Matt
>>>>
>>>>
>>>> Master panel data file:
>>>>
>>>> oshpd_fac_no    year    facility_name    street_address    city    zip_code
>>>> 206010734    2002    EMMANUEL COMVALESCENT HOSPITAL  ALAMEDA    508 WESTLINE DRIVE    ALAMEDA    91011
>>>> 206010734    2003    EMMANUEL CONVALESCENT HOSPITAL  ALAMEDA    508 WESTLINE DRIVE    ALAMEDA    91011
>>>> 206010734    2004    EMMANUEL CONVELESCENT HOSPITALALAMEDA    EMMANUEL CONVALESCENT HOSPITAL    508 WESTLINE DRIVE    91011
>>>> 206010734    2006    EMMANUEL CONVALESCENT HOSPITALALAMEDA    508 WESTLINE DRIVE    ALAMEDA    91011
>>>> 206010734    2007    CROWN BAY NURSING AND REHAB    508 WESTLINE DRIVE    ALAMEDA    91342
>>>> 206010734    2008    CROWN BAY NURSING AND REHAB    508 WESTLINE DRIVE    ALAMEDA    91105
>>>> 206010744    2002    ASHBY CARE CENTER    2270 ASHBY AVENUE    BERKELEY    94115
>>>> 206010744    2003    ASHBY CARE CENTER    2270 ASHBY AVENUE    BERKELEY    96264
>>>> 206010744    2004    ASHBY CARE CENTER    2270 ASHBY AVENUE    BERKELEY    92626
>>>> 206010744    2006    ASHBY CARE CENTER    2270 ASHBY AVENUE    BERKELEY    90801
>>>> 206010744    2007    ASHBY CARE CENTER    2270 ASHBY AVENUE    BERKELEY    94705
>>>> 206010744    2008    ASHBY CARE CENTER    2270 ASHBY AVENUE    BERKELEY    94705
>>>>
>>>>
>>>>
>>>> Address corrected file:
>>>> oshpd_fac_no facility_name street_address city state zip_code
>>>> 206010734 CROWN BAY NURSING AND REHAB 508 WESTLINE DRIVE ALAMEDA CA 94501-5847
>>>> 206010744 ASHBY CARE CENTER 2270 ASHBY AVENUE BERKELEY CA 94705-1935
>>>
>>> *
>>
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/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/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


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