[code:3u2bk0w9]%let d=10;/*10个为一组*/
data result;
set 你的数据集 end=last;
if mod(_n_,&d)=1 then sum=0;
sum+age;
if mod(_n_,&d)=0 then do;mean=sum/&d;group=ceil(_n_/&d);output;end;
else if last then do;mean=sum/mod(_n_,&d);group=ceil(_n_/&d);output;end;
run;
[/code:3u2bk0w9]