Statalist


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

Re: st: RE: data transfer


From   Sergiy Radyakin <serjradyakin@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: data transfer
Date   Mon, 23 Nov 2009 22:13:21 -0500

On Mon, Nov 23, 2009 at 9:12 PM, Nirina F <fstata@gmail.com> 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

See help for -merge- which says:
" keep(results) specifies which observations are to be kept from the
merged dataset.  Using keep(match master) specifies keeping only
matched observations and unmatched master observations after merging."

then it follows:
-quote-
              . merge ..., assert(match master) keep(match)

        is identical to

            . merge ...
            . assert _merge==1 | _merge==3
            . keep if _merge==3
-endquote-

Isn't this what you need? Study the use of the _merge variable which
determines the status of the observation, and the use of the keep()
and assert options, which determine which observations (and varibales)
make it to the resulting dataset.

Best, Sergiy Radyakin


>
> 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/
>>
>
> *
> *   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index