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

 From "Scott Merryman" To 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 -----
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.
>
> 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/
```