proc sql noprint;
create table result
as select * from (
select distinct a.id,b.id as id_match,a.old_value,b.old_value as new_value
from test as a,test as b
where b.old_value ne .
group by a.id
having a.id=b.id or (abs(a.id-b.id)=min(abs(a.id-b.id)) ))
group by id
having id_match=min(id_match);
quit;
如果数据比较大,不知这个速度如何


雷达卡



京公网安备 11010802022788号







