data ahuige;
input group$ x y ;
cards;
a 1 5
a 7 10
a 8 10
b 5 10
b 10 22
b 11 21
b 16 25
c 1 5
d 2 6
d 7 9
d 10 20
d 11 12
d 13 15
d 15 23
e 1 3
f 2 7
f 9 11
;
run;
[code:1kyb58gf]proc sql;
select distinct base.*
from ahuige as base left join ahuige as rule
on base.group=rule.group
having rule.x<base.x and base.x<rule.y and not ( base.x=rule.x and base.y=rule.y)
;[/code:1kyb58gf]
非常感谢ahuige. 实在是佩服.
不过几种特殊情况,还是解决不了,比如以下的dataset.
group x y
a 1 5
a 1 5
a 1 4
a 3 4
a 3 4
a 6 8
...
这种情况下,
a 1 5
a 1 5
a 1 4
a 3 4(1st记录)
这些就无法找出来.请教ahuige, 能否帮忙解决一下.谢谢!