Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: Deleting similar observations


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Deleting similar observations
Date   Wed, 16 Jun 2010 01:01:26 +0200

<>


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


HTH
Martin

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of George Chioran
Sent: Mittwoch, 16. Juni 2010 00:53
To: statalist@hsphsun2.harvard.edu
Subject: st: Deleting similar observations

Dear statlisters, 
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. 
 
Thank you, 
George 


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

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index