[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
"Scott Merryman" <smerryman@kc.rr.com> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: Re: Re: how to flag up obs that are the reverse of other obs? |

Date |
Wed, 26 Feb 2003 22:03:27 -0600 |

Ada, David's solution would flag the first obersvation in the pair exact opposites, but a slight change will make it flag the second observation of the pair. mark weird if o[_n-1] == f[_n] & f[_n-1] == o[_n] Example: . l, clean o f 1. 1 23 2. 14 235 3. 35 90 4. 45 87 5. 87 45 . mark weird if o[_n-1] == f[_n] & f[_n-1] == o[_n] . l, clean o f weird 1. 1 23 0 2. 14 235 0 3. 35 90 0 4. 45 87 0 5. 87 45 1 And then: drop if weird == 1 Scott ----- Original Message ----- From: "Ada Ma" <Pelikan_4001@hotmail.com> To: <statalist@hsphsun2.harvard.edu> Sent: Wednesday, February 26, 2003 8:49 PM Subject: st: Re: how to flag up obs that are the reverse of other obs? > Hi again, > > My original post: > I want to know how to drop some observations. For example I have the > following data, the numbers are identifiers: > > Original Fake > 1 23 > 14 235 > 35 90 > 45 87 > 87 45 > > Now the 4th and 5th pairs are the exact opposite of one another. I want to > drop the 5th observation, but I don't know I can use the data to flag up > such observations so that I can drop it. Could someone show me the light? > > My thanks to David Airey's suggestion, but it didn't work. I tried > something in the vein of what he's suggested, e.g.: > > local i=1 > local j=1 > gen weirdob=. > > while `i'<82845 { > > while `j'<`i' { > replace weirdob[`i']=1 if original[`i']==fake[`j'] & > fake[`i']==original[`j'] > local j=`j'+1 > } > > local i=`i'+1 > } > > Stata wouldn't do weights. Are there other strategies that I can employ?? > > Thanks again. > > Ada Ma > Department of Economics > University of Aberdeen, Scotland > Pelikan_4001@hotmail.com > * > * 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/

**Follow-Ups**:**st: Re: Re: Re: how to flag up obs that are the reverse of other obs?***From:*"Ada Ma" <Pelikan_4001@hotmail.com>

**References**:**st: how to flag up obs that are the reverse of other obs?***From:*David Airey <david.airey@Vanderbilt.Edu>

**st: Re: how to flag up obs that are the reverse of other obs?***From:*"Ada Ma" <Pelikan_4001@hotmail.com>

- Prev by Date:
**Re: st: qreg SEs** - Next by Date:
**RE: st: SSC** - Previous by thread:
**Re: st: Re: how to flag up obs that are the reverse of other obs?** - Next by thread:
**st: Re: Re: Re: how to flag up obs that are the reverse of other obs?** - Index(es):

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