不太确定
[code:3kxkwscx]proc sql;
create table c(drop=dif flag) as
select a.id, a.date, a.date-b.date as dif, min(calculated dif) as flag
from a inner join b
on a.id=b.id and a.date>=b.date
group by a.id
having dif=flag;
quit;[/code:3kxkwscx]
proc sql;
create table c as
select l.*, r.date as adate
from b as l left join a as r
on l.id=l.id and r.date>=l.date
order by id, adate;
quit;
data c; set c; by id adate; if first.id; run;