1
I1 S1 I2 S2 I3 S3 I4 S4 I5 S5 I6 S6 ACTUAL WANTED

10 1  10  2  0  0  0  0   0  0  0  0    3      3

10 1  10  2  10 3  0  0   0  0  0  0    3      6

10 1  10  2  10 3  10 4   0  0  0  0    3      10

if I1=I2 then (S1+S2) elseif I1=I2=I3 then (S1+S2+S3) elseif I1=I2=I3=I4 then (S1+S2+S3+S4) else "" endif the code don't consider the other condition when the first is verified, i don't know how to build a loop and consider all condition. Thank you very much for your help i hope is clear now , and you're write is spss modeler

eli-k
  • 10,898
  • 11
  • 40
  • 44

1 Answers1

0

Your first logical condition covers all cases where I1=I2, including cases where I1=I2=I3 or I1=I2=I3=I4. So ALL these cases will get the result (S1+S2) and none of them are left for the elseif.
In order to give special treatment for the I1=I2=I3=I4 cases is to treat them FIRST, then what's left are the cases where I1=I2=I3 or I1=I2 but not I1=I2=I3=I4. Now you do the same thing with the I1=I2=I3 cases. Once you've treated them, you are left with the rest of the I1=I2 cases.

So I know nothing about SPSS modeler language, but based on the code you've posted, your command should look like this:

if I1=I2=I3=I4 then (S1+S2+S3+S4)
elseif I1=I2=I3 then (S1+S2+S3)
elseif I1=I2 then (S1+S2)
else "" 
eli-k
  • 10,898
  • 11
  • 40
  • 44