Hi, guys:
It is so nice of you. I appreciate your help very much.
The issue in this case can not be taken care of by using sort and by first....
The final observation needs to contain the correct amount.
Thanks Tom. Could you please try again the following case please?
DATA station;
INPUT id date:$10. service $ type $ amt;
CARDS;
1 12/1/2009 station1 A +5
1 12/1/2009 station1 A +15
1 12/1/2009 station1 A -15
2 12/1/2009 station1 B +5
2 12/1/2009 station1 B -5
2 12/1/2009 station1 B 20
2 12/1/2009 station1 B +25
2 12/1/2009 station1 B -25
3 12/1/2009 station1 B +55
3 12/1/2009 station1 B -55
3 12/1/2009 station1 B 55
;
RUN;
proc sql;
select id, date, service, type, amt
from station
group by id, date, service, type, abs(amt)
having count(*) < 2
;
quit;
final expects the following.
1 12/1/2009 station1 A +5
2 12/1/2009 station1 B 20
3 12/1/2009 station1 B 55
Message was edited by: tulip
... View more