proc sort data=have out=temp;
by name t;
run;
data want(drop=_t cnt);
set temp;
by name t;
retain cnt _t;
if first.name then do;
_t=t;
if if ne 1 then cnt=0; else cnt=1;
end;
if if=1 and cnt_t then _is=1;
else _is=0;
run;
proc sort data=have out=temp;
by name t;
run;
data want(drop=_t cnt);
set temp;
by name t;
retain cnt _t;
if first.name then do;
_t=t;
if if ne 1 then cnt=0; else cnt=1;
end;
if if=1 and cnt<2 then do; cnt=cnt+1; _t=t; end;
if cnt=1 and t-_t<=2 and if ne 1 then _is=1;
else if cnt>1 and t>_t then _is=1;
else _is=0;
run;