thank you very much for the help!
sara
--- Michael Blasnik <[email protected]> ha
scritto:
> I'm not sure if you require that the charges exactly
> offset each other or
> not, but if they do, then this should work:
>
> gen abscharge=abs(charge)
> bysort personid proc date abscharge (charge) : gen
> hasnegative=charge[1]<0
> bysort personid proc date abscharge : gen
> sumcharge=total(charge)
> drop if hasnegative & sumcharge==0
> drop hasnegative sumcharge
>
> You may want to browse at the dataset prior to
> issuing the drop command to
> see if it does what you want.
>
> Michael Blasnik
>
> ----- Original Message -----
> From: "sara borelli" <[email protected]>
> To: <[email protected]>
> Sent: Tuesday, March 06, 2007 1:48 PM
> Subject: st: eliminate negative values and their
> positive counterpart
>
>
> > dear satalist members,
> >
> > This is an exctract of my data:
> >
> <snip>
> > where the dots indicate that other values for the
> same
> > personid are in between. I need to eliminate the
> > negative charges AND their positive counterpart
> with
> > the same proc and date. Thus, for example I need
> to
> > eliminate the negative
> > -13 80048 6/7/2001
> > AND its positive counterpart with the same proc
> and
> > date:
> > +13 80048 6/7/2001,
> > and so on.
> > I should find a way to construct an algorithm that
> > identifies and eliminates the negatives AND their
> > poistive counterpart with he same date and
> procedure,
> > but I cannot figure that out.
> > Any help would be really appreciated
> >
> > thanks
> > Sara Borelli
>
> *
> * 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/
>
___________________________________
L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail:
http://it.docs.yahoo.com/nowyoucan.html
*
* 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/