|
我刚写了这个,还可以用,对于小数据集。数据集Result就是你要的结果了
可能还需要调试
data konzern;
Input ID konzernID;
cards;
1 18
2 5
3 18
4 24
5 9
6 9
7 15
8 12
9 102
;
run;
proc iml;
use konzern;
read all var _num_ into m;
close konzern;
a=m[,1];
b=m[,2];
create max var {max_number};
do i=1 to nrow(m);
if ncol(loc(a=b[i,]))>0 then do;
c=loc(a=b[i,]);
max_num=b[c,];
do while(ncol(loc(a=max_num))>0);
d=loc(a=max_num);
max_num=b[d,];
end;
end;
else do;
max_num=b[i,];
end;
edit max;
append from max_num;
end;
quit;
data result;
merge konzern max;
run; |
|