以下循环无法正确创建任何交互项(即彼此相乘的新变量)。我不确定如何正确指定x(#j + #i)
,所以也许这就是搞乱的事情。
DATA LIST LIST / A1L1 A1L2 A1L3 P1 P2 P3 P4 P5 P6 P7 P8 P9 P10.
BEGIN DATA
1 0 0 1 0 0 0 0 0 0 0 0 0
1 0 0 0 1 0 0 0 0 0 0 0 0
0 1 0 0 0 1 0 0 0 0 0 0 0
0 1 0 0 0 0 1 0 0 0 0 0 0
0 0 1 0 0 0 0 1 0 0 0 0 0
0 0 1 0 0 0 0 0 1 0 0 0 0
-1 -1 -1 0 0 0 0 0 0 1 0 0 0
-1 -1 -1 0 0 0 0 0 0 0 1 0 0
-1 -1 -1 0 0 0 0 0 0 0 0 0 1
END DATA.
LIST.
vector A1L1P A1L2P A1L3P (10).
vector x = A1L1P1 to A1L3P10.
VECTOR ASC = P1 to P10.
VECTOR EcLvl = A1L1 to A1L3.
LOOP #j = 1 to 3.
LOOP #i = 1 to 10.
COMPUTE x(#j + #i) = (ASC(#i) * EcLvl(#j)).
END LOOP.
END LOOP.
EXECUTE.
答案 0 :(得分:0)
而不是
COMPUTE x(#j + #i) = (ASC(#i) * EcLvl(#j)).
我想你想要
COMPUTE x(10*(#j-1) + #i) = (ASC(#i) * EcLvl(#j)).