我無法對多維數組的子集中的所有值求和?如何求和多維數組的一個子集
_sum = sum(of _valores [_i,_x,_quadrado,*]);
我知道我可以總結一維數組
E.G. _sum = sum(_arraName [*]);
代碼::
data teste;
array _quadros{3,3,9} _temporary_;
array _valores{3,3,9,9} _temporary_;
/*Zera todos os valores*/
do _i = 1 to 9;
do _z = 1 to 3;
do _t = 1 to 3;
do _x = 1 to 9;
_valores[_z,_t,_i,_x] = 1;
end;
end;
end;
end;
do _quadrado = 1 to 9;
do _i = 1 to 3;
do _x = 1 to 3;
_sum = sum(of _valores[_i,_x,_quadrado,*]);
put _sum =;
end;
end;
end;
run;
錯誤::
_sum = sum(of _valores[_i,_x,_quadrado,*]);
ERROR 386-185: Expecting an arithmetic expression.
ERROR 200-322: The symbol is not recognized and will be ignored.
ERROR 76-322: Syntax error, statement will be ignored.
您是否有PROC IML?如果你想做矩陣運算,最好使用適合這種分析的工具。 – Reeza
這實際上是一個很好的問題,對於那些有權訪問IML的人來說可能很有用。 – DomPazz
我沒有訪問= /。 –