Statalist


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

RE: st: eliminating unique values


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: eliminating unique values
Date   Fri, 2 May 2008 11:17:26 +0100

. 
That's what I would recommend. The second method can be implemented
directly:

bysort X : drop if _N == 1 

so that the extra variable is dispensable. 

Eva Poen

008/5/2 Stefano  Costalli <stefano.costalli@imtlucca.it>:

>  I have a variable with about 25.000 observations and many unique
values. I need to drop the unique values, but I can't browse the whole
data set to search for each unique value individually.

I'm not quite I understand. Do you have one variable X in your data,
and within X there are some duplicates, and you want to drop
everything that is unique? In this case you can either use

duplicates tag X, gen(tag)
drop if tag==0

or, equivalently,
bysort X: gen drop = _N
drop if drop==1


*
*   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