0

Is something like this possible in spss? COMPUTE new_var = (COUNT var1 to var5 (1))*2 + (COUNT var1 to var5 (2))*3

4

2 回答 2

0

未经测试的语法。

RECODE var1 to var5 (1 = 2) (2 = 3) (else = 0) into tmp1 to tmp5.
COMPUTE new_var = sum(tmp1 to tmp5).
于 2012-05-26T19:37:11.573 回答
0

自己找到了解决办法:

COMPUTE myindex= 0.
DO REPEAT v=var1 TO var5.
   DO IF v=1.
      COMPUTE myindex= myindex+2.
   END IF.
   DO IF v=2.
      COMPUTE myindex= myindex+3.
   END IF.
END REPEAT.
于 2012-05-26T14:15:21.393 回答