按照公式,最终只能求出一个数字,而不是一个变量。如果确定这是你需要的,SPSS的普通语法应该是无法实现你需要的功能。
在确保不存在缺失数据的情况下,可以使用以下矩阵语法进行计算,SPSS会输出计算数值。
其中,Var1 是用于计算的目标变量,替换为你的变量名即可。
/****************** SPSS语法 ******************.
set mxloop=1000000.
matrix.
get raw/file=*/vars= Var1 /missing=omit.
compute ncase=nrow(raw).
compute sumofall=0.
loop #q=1 to ncase.
compute a1=make(ncase,1,raw(#q,1)).
compute sumofall=sumofall+csum(abs(a1-raw(:,1))).
end loop.
print sumofall/title='Sum of all'/format=f20.16.
end matrix.


雷达卡







京公网安备 11010802022788号







