data c;
set b;
by stkcd year;
if first.stkcd then zong_quesheng=0;
zong_quesheng+1;
if last.stkcd;
run;
data d;
set b;
by stkcd year;
lag_year=lag(year);
if first.stkcd then lianxu_quesheng=1;
if year=lag_year+1 then lianxu_quesheng+1;
if last.stkcd;
run;