Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: Deleting Duplicates based on criteria
From
"Dirlam, Jonathan C." <[email protected]>
To
"[email protected]" <[email protected]>
Subject
st: Deleting Duplicates based on criteria
Date
Thu, 11 Jul 2013 14:18:07 +0000
Dear Statalist,
I have duplicate observations where the duplicates are the same court case number. I want to eliminate all the observations for a court case except for the observation that has the highest charge (homicide, robbery, etc.) I have 12 dummy variables that capture charges and used the duplicates command to get unique ids for each court case number. Is there a way to write a program that eliminates or keeps duplicates based on criteria you give it (Example, homicidedummy==1) and stops once all but one observation are eliminated?
Thanks.
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/