data a;
input a n b @@;
cards;
0.01 1 0.01
0.01 2 0.02
0.03 3 0.05
0.11 4 0.16
0.07 5 0.23
0.00 1 0.00
0.05 1 0.05
0.00 2 0.05
0.00 6 0.05
0.00 1 0.00
0.00 2 0.00
0.00 3 0.00
0.00 4 0.00
0.00 5 0.00
0.03 1 0.03
0.00 2 0.03
0.00 3 0.03
0.01 4 0.04
0.00 5 0.04
0.01 1 0.01
0.05 2 0.06
0.05 3 0.11
0.05 4 0.16
0.00 1 0.00
0.00 2 0.00
;
run;
data b;
set a;
if n=1 then do;
type+1;
end;
else;
run;
proc sort data=b out=c;
by type n;
run;
data d (drop=type);
merge c c;
by type;
if first.type=1 or last.type=1;
run;
d 就是所需要的数据集。