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

Re: st: analogue of NODUPKEY

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

At 11:05 PM 12/29/2003 -0500, 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:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index