Deego
Deego

Reputation: 13

SPSS Count depending on Conditions in several variables

I am quite new to SPSS and I need to count the number of certain errors made in a test (Stroop Test). There are three kinds of variables:

Each type exists 80 times called e.g. theCongruencies_1 to the theCongruencies_80. I want to count how many times there is the same value in theWordKeys_x and thePressedKeys_x when theCongruencies_x has the value 'I'.

Example: theCongruencies_42 = 'I' theWordKeys_42 = 88 thePressedKeys_42 = 88

So I need to do something like this in my SPSS Code:

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

Thanks a lot Deego

Upvotes: 1

Views: 175

Answers (1)

eli-k
eli-k

Reputation: 11360

Try this:

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.

Upvotes: 0

Related Questions