Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Re: Replacing Address Information in Panel Data Set


From   Eric Booth <ebooth@ppri.tamu.edu>
To   "<statalist@hsphsun2.harvard.edu>" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: Re: Replacing Address Information in Panel Data Set
Date   Tue, 13 Jul 2010 03:27:32 +0000

<>

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
ebooth@ppri.tamu.edu
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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index