Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | "Nick Cox" <n.j.cox@durham.ac.uk> |
To | <statalist@hsphsun2.harvard.edu> |
Subject | RE: st: RE: Deleting similar observations |
Date | Wed, 16 Jun 2010 10:11:00 +0100 |
My guess differs. Martin's code should work in any recent version of Stata. I suspect a typo, but this remains an open question because George does not disclose precisely what he typed. In addition, note that this problem is only a very small step away from that discussed within an FAQ: FAQ . . . . . . Listing observations in a group that differ on a variable 11/01 How do I list observations in a group that differ on a variable? http://www.stata.com/support/faqs/data/diff.html Nick n.j.cox@durham.ac.uk Martin Weiss That makes me think you have an old version of Stata. Note you are meant to disclose any version other than 11.1. George Chioran I try this, but I keep getting the message: "time-series operators not allowed". Martin Weiss So Account 7 should also be -drop-ped, I guess: *********** clear* inp byte Account str1 Buy_sell 2 b 2 b 2 s 2 b 5 s 5 s 5 s 5 s 7 s 7 s end list, noo bys Account (Buy_sell): drop if Buy_sell[1]==Buy_sell[_N] list, noo *********** George Chioran I have a database that looks like this: Account Buy sell 2 b 2 b 2 s 2 b 5 s 5 s 5 s 5 s 7 s 7 s Taken per account, I would like to know if there is a way to delete all the observations that have the same letter in the Buy sell variable. In my case this would delete all observations from account 5 since they are all only sell. * * 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/