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

Re: st: analogue of NODUPKEY


From   Richard Williams <[email protected]>
To   [email protected]
Subject   Re: st: analogue of NODUPKEY
Date   Mon, 29 Dec 2003 23:32:49 -0500

At 11:05 PM 12/29/2003 -0500, [email protected] wrote:
Dear Statalisters,

I am looking for a Stata analogue of a SAS procedure for a certain type of
duplicate removal.  Suppose a dataset has fields A-J. For all subsets of
records for which fields A-C are identical, I wish to keep only the first
record and discard the rest, keeping all fields of the retained records.
What is the simplest way to do this with Stata commands?
Does the duplicates drop command do what you want? e.g.

duplicates drop a b c, force

From the online help:

"duplicates drop drops all but the first occurrence of each group of duplicated observations... force specifies that observations duplicated with respect to a named varlist are to be dropped. The force option is required whenever such a varlist is given, as a reminder that information may be lost by dropping observations, given that those observations may differ on any of the variables not included in varlist."

*
* 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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index