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: RE: Unexpected error from -merge-


From   Jacob-Jan Koopmans <[email protected]>
To   [email protected]
Subject   Re: st: RE: RE: Unexpected error from -merge-
Date   Mon, 23 Sep 2013 22:53:05 +0200

It indeed looks like -isid- is the way to go.

Thanks a lot!
Jacob

On Mon, Sep 23, 2013 at 6:22 PM, Radwin, David <[email protected]> wrote:
> Yes, and please consider using -isid-, which detects missing values as well as duplicate values. Occasionally this may save you from trouble. For example:
>
> . clear
>
> . set obs 100
> obs was 0, now 100
>
> . gen cbhiind=_n in 1/99
> (1 missing value generated)
>
> . duplicates report cbhiind
>
> Duplicates in terms of cbhiind
>
> --------------------------------------
>    copies | observations       surplus
> ----------+---------------------------
>         1 |          100             0
> --------------------------------------
>
> . isid cbhiind
> variable cbhiind should never be missing
> r(459);
>
> David
> --
> David Radwin
> Senior Research Associate
> Education Studies Division
> RTI International
> 2150 Shattuck Ave., Suite 800
> Berkeley, CA 94704
> Phone: 510-665-8274
>
> www.rti.org
>
>> -----Original Message-----
>> From: [email protected] [mailto:owner-
>> [email protected]] On Behalf Of Joe Canner
>> Sent: Monday, September 23, 2013 8:48 AM
>> To: [email protected]
>> Subject: st: RE: Unexpected error from -merge-
>>
>> By default when you do -duplicates report-, it is looking for duplicates
>> with respect to every variable in your data set, which is why you have all
>> unique records.  What you want is -duplicates report actpsid- which will
>> give you just the duplicates with respect to the variable you are trying
>> to merge on.
>>
>> Regards,
>> Joe Canner
>> Johns Hopkins University School of Medicine
>>
>> -----Original Message-----
>> From: [email protected] [mailto:owner-
>> [email protected]] On Behalf Of Jacob-Jan Koopmans
>> Sent: Monday, September 23, 2013 11:21 AM
>> To: [email protected]
>> Subject: st: Unexpected error from -merge-
>>
>> Dear list members,
>>
>> I am receiving an unexpected error when merging data.
>> I am using stata 12.
>>
>> I am trying to merge data in the following way:
>> "sort actpsid
>> merge 1:m actpsid using "cbhiind" ".
>>
>> This, however, results in the following error:
>> "variable actpsid(my individual identifier) does not uniquely identify
>> observations in the master data r(459)."
>> This would normally suggest(as far as I know), there are duplicates of
>> actpsid in the master data. However, when checking for duplicates by
>> using: duplicates report. I receive the following nice report:
>>
>> "Duplicates in terms of all variables
>> --------------------------------------------------------
>>    copies | observations       surplus
>> ----------+--------------------------------------------
>>         1 |         8772             0
>> --------------------------------------------------------"
>>
>> Therefore, I suppose the error is not resulting from duplicates in my
>> identifier variable.
>>
>> I would thus like to ask whether there are other reasons why the above
>> mentioned error appears.
>>
>> Kind regards,
>> Jacob-Jan Koopmans
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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