in SPSS script, I am trying to create a filter that indicates if all the variables are 1, it would return a summary variable indicating 1.
I’ve tried the following in the SPSS script:
if (var1 TO var25 = 1 AND var29 TO var54 = 1) filtervar = 1.
gave me the following error:
2937 if An expression contains an invalid or inappropriate use of the TO keyword. The TO keyword may be used in the MEAN, SUM, and other similar functions in lieu of entering individual variable names, but it may not be used in other contexts.
I understand the long way would be to write:
if (var1 = 1 & var2 = 1 & var3 =1 …) filtervar=1.
but that would take too long (I have 74 vairables! I would like the script to be concise as well).
Any recommendations?
Jeremy Pan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.