Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Re: merging without repeat obs in master dataset


From   "Mingfeng Lin" <mingfeng.lin@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Re: merging without repeat obs in master dataset
Date   Fri, 23 May 2008 07:32:13 -0400

Oh... Thank you! I am new to the -sort- option actually; guess there's
a catch to its convenience.  :)

Mingfeng


On Fri, May 23, 2008 at 7:03 AM, Michael Blasnik
<michael.blasnik@verizon.net> wrote:
> ...
>
> Your first statement is incorrect -- merge does not require a unique key
> unless you tell it that's what you expect/want/require.
> Just omit the -sort- option to your merge command and it will work.  The
> help for -merge- notes that -sort- implies that the key is unique in both
> datasets.
>
> M Blasnik
>
> ----- Original Message ----- From: "Mingfeng Lin" <mingfeng.lin@gmail.com>
> To: <statalist@hsphsun2.harvard.edu>
> Sent: Thursday, May 22, 2008 10:51 PM
> Subject: st: merging without repeat obs in master dataset
>
>
>> Greetings!
>>
>> The -merge- command in Stata requires that the variable to merge
>> uniquely identify observations in the master dataset.  But how should
>> I merge if the variable I would like to merge on does not uniquely
>> identify master dataset observations?
>>
>> For instance:
>> Master: ID GROUP
>> (multiple IDs could be in the same group)
>>
>> Using dataset:   GROUP GROUPDEMOGRAPHICS
>>
>> I wanted to do
>> .merge GROUP using ..., sort
>>
>> error message r(459):  something that should be true of your data is not;
>>
>> My final dataset should have each ID as an observation. Is there
>> something I can do to work around this?
>>
>> Thank you!
>>
>> Mingfeng
>
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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