SPSS 计数取决于几个变量中的条件

SPSS Count depending on Conditions in several variables

我是 SPSS 的新手,我需要计算测试(Stroop 测试)中某些错误的数量。共有三种变量:

每种类型存在 80 次调用,例如theCongruencies_1 到 theCongruencies_80。 当 theCongruencies_x 的值为 'I'.

时,我想计算 theWordKeys_x 和 thePressedKeys_x 中有多少次相同的值

示例:theCongruencies_42 = 'I' theWordKeys_42 = 88 thePressedKeys_42 = 88

所以我需要在我的 SPSS 代码中做这样的事情:

    COMPUTE InhibErrs = COUNT(
                   IF( 
                     theCongruencies_1 to theCongruencies_80 EQ 'I' 
                     AND theWordkeys_1 to theWordkeys_80 EQ thePressedKeys_1 to thePressedKeys_80)).
    execute.

非常感谢 迪戈

试试这个:

compute countVar=0.  
do repeat theCongruencies=theCongruencies_1 to theCongruencies_80
          /theWordkeys=theWordkeys_1 to theWordkeys_80
          /thePressedKeys=thePressedKeys_1 to thePressedKeys_80.
   compute countVar=sum(countVar, (theCongruencies="I" and theWordkeys=thePressedKeys)).
end repeat.
exe.