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

From |
Nirina F <fstata@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: RE: data transfer |

Date |
Tue, 24 Nov 2009 09:41:55 -0500 |

Thank you very much for your help! On Mon, Nov 23, 2009 at 10:26 PM, Eric Booth <ebooth@ppri.tamu.edu> wrote: >> >> > Nirina: > > From your initial posting, you say that you would like to have the community information from 1995 data merged with the larger 2005 dataset in order to update the 2005 data with old community variables--in this case your 2005 dataset should be the master. You latest post implies the opposite, that you are merging the larger 2005 data to the 1995 which gives you 8000 missing observations (not variables). > > We probably need a better description of your data to give a good answer, but I think you want the former, not the latter, so it might something look like: > > *********** > //setup// > clear* > input year region comm_hosp > 1995 1 931 > 1995 1 941 > 1995 2 952 > 1995 2 962 > 1995 3 973 > 1995 4 983 > 1995 5 993 > end > expand 1000 > **now, 7000 obs in 1995 > sort region > collapse (mean) comm_hosp (max) year, by(region) > save "using.dta", replace > > clear* > input year region > 2005 1 > 2005 1 > 2005 1 > 2005 2 > 2005 2 > 2005 2 > 2005 2 > 2005 3 > 2005 3 > 2005 3 > 2005 3 > 2005 3 > 2005 4 > 2005 5 > 2005 6 > end > > expand 1000 > **now, 15000 obs in 2005 > sort region > save "master.dta", replace > ** > //merge// > merge m:1 region using "using.dta", keepusing(comm_hosp) > tab comm region > > **note that region 6 doesn't exist in 1995** > tab _merge > *********** > > It sounds like you've got individual level observations from 2005, but that you want the community information (by region) merged to your 2005 individual level data. That's why I collapsed the community hospital (comm_hosp) variable by its mean, but you will need to think about what to do with the community level indicators in your dataset. > > Eric > > __ > Eric A. Booth > Public Policy Research Institute > Texas A&M University > ebooth@ppri.tamu.edu > Office: +979.845.6754 > > > > > On Nov 23, 2009, at 8:12 PM, Nirina F wrote: > >> Thank you very much for your response. >> I actually tried -merge- by region but the problem is the difference >> in the number of observations in both data. >> My problem is how do I deal with the difference in observations >> because I do not want to have 8000 missing variables as the first data >> has 7000 observations and the second has 15000. >> N >> >> On Mon, Nov 23, 2009 at 4:22 PM, Lachenbruch, Peter >> <Peter.Lachenbruch@oregonstate.edu> wrote: >>> If the community information is basically the same, you need to treat >>> this as a relational data base. Anyway that sounds like a many:one >>> merge >>> >>> Tony >>> >>> Peter A. Lachenbruch >>> Department of Public Health >>> Oregon State University >>> Corvallis, OR 97330 >>> Phone: 541-737-3832 >>> FAX: 541-737-4001 >>> >>> >>> -----Original Message----- >>> From: owner-statalist@hsphsun2.harvard.edu >>> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nirina F >>> Sent: Monday, November 23, 2009 10:54 AM >>> To: statalist@hsphsun2.harvard.edu >>> Subject: st: data transfer >>> >>> Hello, >>> >>> I would very much appreciate if you could help me on this one. >>> >>> I have a household survey data of about 7000 in 1995 data on >>> community such as region, number of hospitals etc... >>> Now I have a 2005 dataset of about 15000 in 2005 but do not have the >>> community data that I had in 1995. >>> I was wondering how could I merge those datasets in order to have at >>> least the community data that I have in 1995 for 2005. >>> thank you very much in advance, >>> Nirina >>> * > > > * > * 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/

**References**:**st: data transfer***From:*Nirina F <fstata@gmail.com>

**st: RE: data transfer***From:*"Lachenbruch, Peter" <Peter.Lachenbruch@oregonstate.edu>

**Re: st: RE: data transfer***From:*Nirina F <fstata@gmail.com>

**Re: st: RE: data transfer***From:*Eric Booth <ebooth@ppri.tamu.edu>

- Prev by Date:
**st: AW: Programing error** - Next by Date:
**st: Calculating readmissions for specific providers** - Previous by thread:
**Re: st: RE: data transfer** - Next by thread:
**st: RE: create predicted values manually using matrices** - Index(es):

© Copyright 1996–2017 StataCorp LLC | Terms of use | Privacy | Contact us | What's new | Site index |