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

st: Duplicates drop


From   "Thomas Speidel" <[email protected]>
To   <[email protected]>
Subject   st: Duplicates drop
Date   Wed, 1 Jun 2005 12:35:14 -0600

When using duplicates drop, Stata will keep the first occurrence and
drop any subsequent ones.  If you want to selectively drop specific
duplicates, then I suggest you do it manually, for example:

bysort id: gen dup=_n
gen dup2="YES" if dup>1
replace dup2="NO" if dup==1

then, you can selectively drop the observations you want according to
the value of some other variable, for example:

drop if dup2=="YES" & some_variable=="something_value"

Hope this helps,
Thomas

Thomas Speidel
Statistical Associate
Department of Oncology
Tom Baker Cancer Centre
1331 - 29th Street N.W.
Calgary, AB, T2N 4N4

Tel. (403) 521-3370
Email: [email protected]

This e-mail and any attachments may contain confidential and
privileged information. If you are not the intended recipient,
please notify the sender immediately by return e-mail, delete this
e-mail and destroy any copies. Any dissemination or use of this
information by a person other than the intended recipient is
unauthorized and may be illegal.

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