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   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: how do you drop repeated values in a variable to remain with only one?
Date   Sun, 21 Apr 2013 09:43:55 +0100

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/


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