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: Dropping Observations based on Observations Across Rows


From   Beatrice Benavidez <beatricestata1711@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: RE: Dropping Observations based on Observations Across Rows
Date   Thu, 18 Oct 2012 18:11:08 +0400

Hi all,

I have this example subset of a dataset:
Date ID Description
1/1    1        Purchase
1/1    1          Refund
1/1    2        Purchase
1/1    2          Refund
1/1    3        Purchase
1/1    4        Purchase
2/2    1        Purchase
2/2    2        Purchase
2/2    3        Purchase
2/2    3          Refund
2/2    4        Purchase
2/2    4          Refund

For a particular date and ID, there is a description variable where I
have Purchase and Refund
I would like for the one particular date and ID to then drop those
observations completely where there are both Purchase and Refund
counterparts in the subset dataset.

I would then like my subset dataset to be reduced to:
Date ID Description
1/1    3        Purchase
1/1    4        Purchase
2/2    1        Purchase
2/2    2        Purchase

How will I go about doing this.

Thank you so much!

Kind regards,


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


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index