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: how do you drop repeated values in a variable to remain with only one?


From   Gwinyai Masukume <[email protected]>
To   [email protected]
Subject   Re: st: how do you drop repeated values in a variable to remain with only one?
Date   Sun, 21 Apr 2013 11:18:15 +0200

Dear Daniel and Nick,

Thank you. Unfortunately, I could not reproduce the exact variable and
values as patient information must be de-identified.

Along with variable A, there is variable B, C, D, E, which can differ
with the same value of A. I want to remain with a single value of A (I
am aware data will be lost).
I agree 'does not work' is not right. I am the one failing to figure
out things. Please assist.

Kind regards,
Gwinyai

On 4/21/13, Nick Cox <[email protected]> wrote:
> As the author of -duplicates-, I object strongly to the wording
>
> "does not work"
>
> here.
>
> 1. -duplicates- is designed to allow you to -drop- duplicates when
> they merely repeat information, so it is entirely a feature that it
> resists your use here.
>
> 2. The -force- option is nevertheless available to do what you want.
> and is documented in the help.
>
> -force- specifies that observations duplicated with respect to a named
> varlist be dropped.
>         The -force- option is required when such a varlist is given as
> a reminder that
>         information may be lost by dropping observations, given that
> those observations may
>         differ on any variable not included in varlist.
>
> It is, however, a recipe for arbitarily discarding much of the
> information in your data.
>
>
> Nick
>
> Nick
> [email protected]
>
>
> On 21 April 2013 07:51, Gwinyai Masukume <[email protected]> wrote:
>
>> I have a dataset  with variable A, which has repeated  values:
>>
>> A
>> 1
>> 2
>> 2
>> 2
>> 3
>> 3
>> 4
>> 5
>> 5
>> 6
>> 6
>> 6
>>
>> Where the values are repeated e.g 2. I would like to drop the repeated
>> values and remain with only a single 2.
>> I have tried the duplicates drop command, but it does not work as the
>> repeated values are not duplicates, but say different hospital visits by
>>  the same individual.
>> I would still like to drop repeated values of the variable A. How can I
>> do this?
>>
> *
> *   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