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

Re: st: Duplicates drop


From   Sophie Chen <Sophie.Chen@CalgaryHealthRegion.ca>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Duplicates drop
Date   Wed, 01 Jun 2005 12:53:30 -0600

Thank.

----- Original Message -----
From: Thomas Speidel <thomassp@cancerboard.ab.ca>
Date: Wednesday, June 1, 2005 12:35 pm
Subject: st: Duplicates drop

> 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: thomassp@cancerboard.ab.ca
> 
> 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/
> 

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