data bbb(keep=no time mean);
set aaa;
by no time;
if first.no and first.time then do; num=0; total=0; end; /*防止上一号最大time与下一号最小time相同*/
if first.time then do; num=0; total=0; end;
total+x;
num+1;
if last.time then do;
mean=total/num; output;
end;
run;