Bookmark and Share

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: Dropping Duplicates that Aren't Exactly Duplicates


From   Lisa Chavez <[email protected]>
To   [email protected]
Subject   st: Dropping Duplicates that Aren't Exactly Duplicates
Date   Wed, 02 Nov 2011 11:06:08 -0700

I have data in long file format that has three variables: id, arrdate and violation.

Below is an example of a person who has three arrest events (I have separated them with lines).

Looking at the first two arrest dates (11mar2004 and 13jan2005) you see that each arrest has three violations and they are exactly the same.

I have lots of examples like this one; in all instances I want to drop the last arrest event where this duplication occurs.

In the case below, I would want to drop all rows associated with the 13jan2005 arrest event.

I'd appreciate any help you can offer.

Thanks!

Lisa

+----------------------------------------------------------------------------------------+
id arrdate violation
----------------------------------------------------------------------------------------
A0000518 11mar2004 Cocaine-Possess Possess Cocaine A0000518 11mar2004 Nonmoving Traffic Viol Drive While Lic Susp Habitual Offender A0000518 11mar2004 Traffic Offense Dui Alcohol Or Drugs 1St Off
----------------------------------------------------------------------------------------
A0000518 13jan2005 Cocaine-Possess Possess Cocaine A0000518 13jan2005 Nonmoving Traffic Viol Drive While Lic Susp Habitual Offender A0000518 13jan2005 Traffic Offense Dui Alcohol Or Drugs 1St Off
----------------------------------------------------------------------------------------
A0000518 27feb2009 Hallucinogen-Sell Schedule Ii
+----------------------------------------------------------------------------------------+



--
Lisa Chavez, Ph.D.
Senior Research Associate
Chief Justice Earl Warren Institute on Law and Social Policy
Berkeley Law School

2850 Telegraph Ave. Suite 500
Berkeley, CA 94705-7220
Tel 510-642-8567
Fax 510-643-7095
Email:  [email protected]

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index