SPSS tutorials


SPSS ANY Function


SPSS' ANY is used to compare one value to a set of other values.

SPSS Any - Basics

SPSS Any - Examples

SPSS Any - Syntax Examples

* Create tiny dataset.

data list free/id.
begin data
1 2 3 4 5 6 7 8 9 10
end data.

do repeat v = throw_1 to throw_4.
compute v = trunc(rv.uniform(1,7)).
end repeat.

*1. Did the first throw result in one of the values 1, 4, 5?.

compute check_1 = any(throw_1,1,4,5).

*2. Was there any 6 among the four attempts?.

compute check_2 = any(6,throw_1 to throw_4).

*3. Did the outcome of the first throw occur in any of the subsequent throws?.

compute check_3 = any(throw_1,throw_2 to throw_4).

*4. Was the outcome of the last throw either equal to 6 or the first throw ?.

compute check_4 = any(throw_4,throw_1, 6).

value labels check_1 to check_4 0 'No' 1 'Yes'.


TRUNC(RV.UNIFORM(1,7)) generates random integer values from 1 through 6 with equal probabilities. Hence it simulates throws with a balanced die. Also, see RV.UNIFORM.

Previous tutorial: SPSS ALTER TYPE – Simple Tutorial

Next tutorial: SPSS Datasets

Let me know what you think!

*Required field. Your comment will show up after approval from a moderator.