data want(keep=id);
set text1;
by id;
retain lyear;
if first.id then do;
lyear = year;count = 1;end;
else do;
if year = lyear + 1 then do; lyear = year;count+1;end;
end ;
if last.id and count<3 then output;
run;
proc sort data=orginal out=temp01; by id year;run;
data temp02;
set temp01;
lagyear=lag(year);
by id;
if first.id then lagyear=.;
year_dif = year - lagyear;
run;
data want(drop=year_dif);
set temp02;
if year_dif gt 1;
run;