Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

duplicates [was: RE: st: help]


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   duplicates [was: RE: st: help]
Date   Mon, 15 Dec 2003 16:56:30 -0000

(Please use informative titles for your postings.) 

Stata 8 includes an official general-purpose command 
called -duplicates-. 

In your case, I am not clear whether 
time order is important, i.e. duplicates 
must be similar to each other _and_ 
adjacent in time. I'll guess not. 

. duplicates report a b c 

is one starting point. 

If you do not have Stata 8, 

. findit duplicates  

finds some alternatives. 

Nick 
n.j.cox@durham.ac.uk 

Dev Vencappa
> 
> I have the following problem. Suppose I have 100 different 
> variables named differently. Suppose a b c are three of the 
> variables and I sort the data by a b and c. Because I 
> appended several datasets, I want to check for duplicate 
> values,ie count if a==a[_n-1] & b==b[_n-1] & c==c[_n-1] and 
> so on. However if I have hundreds of other variables in the 
> data set, is there a shorter way of asking Stata to check 
> varX==varX[_n-1] rather than typing each individual 
> variables separately, noting that the condition has to be  
> checked against the same variable's lagged value? I am not 
> sure the use of  * is of help here. Can anyone help please?
> 

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