这样能解决你的问题吗?
proc sql;
create table step1 as
select * from test
where y ne . or x in (select y from test where y ne .);
quit;
data fmt;
set step1;
retain fmtname "point";
rename x=start y=label;
run;
proc format cntlin=fmt;
run;
data step2;
set step1(keep=y);
where y ne .;
x=input(put(y,point.),best.);
rename y=x x=y;
run;
proc sort data=step2;
by x y;
run;
data step3;
set step2;
by x y;
if first.x=1 and last.x=1 and y=. then delete;
if first.x and y=. then delete;
run;
data wanted;
set step1 step3;
run;
proc sort data=wanted;
by x;
run;