data table1;
set table;
year=year(date);
proc summary data=table1 nway;
var pb;
class year;
ouput out=table2 mean=meanpb;
data outtable;
drop rc year;
set table1;
if _n_=1 then do;
declare hash h(dataset:'table2');
h.defindkey('year');
h.definedone();
end;
rc=h.find(key:year);
if rc=0 then meanpb=meanpb;
run;