/*method 2*/
data b;
set a(where=(2005<year<2015));
by id;
dif=dif(year);
if first.id then diff=.;else diff=dif;
if (first.id & year^=2006)| (last.id & year^=2014)| (not first.id & diff^=1) then output;
run;
data final1;
merge a b(keep=id in=b);
if not b;
run;