You are on page 1of 9

The ANY function

in IBM SPSS Statistics


The ANY function

• A very useful logical function


- ANY(test, value1, value2, ....)

• Returns a value of 1 if the test is true and 0 otherwise.

• e.g. ANY(var1, 1, 3, 5)
- Will return a value of 1 if var1 has a value of 1, 3 or 5.
Otherwise it will return a value of 0

• Instead of using a series of or statements


- ANY(var1, 1, 3, 5) = (var1=1 or var1=3 or var1=5)

2
The ANY function

 The ANY function can also be used to scan a list of variables


or expressions for a value

 .For example ANY(1, var1, var2, var3) returns a value of 1 if


any the specified variables have a value of 1, otherwise it will
return a value of 0.

 The equivalent logical statement using or statements would


be
• (var1=1 or var2=1 or var3=1)

3
Sample file: cable_survey.sav

4
An example of the ANY function

 Using cable_survey.sav located in


C:\Program Files\IBM\SPSS\Statistics\*Version\Samples\English
*Version: Your SPSS Statistics Version, e.g. 20, 21, 22,…

 We will use the ANY function


in the select cases procedure
to create a new dataset with
categories 1, 3 and 4 of the
variable hometype

5
Select Cases

 Data -> Select Cases -> If condition is satisfied

6
Select cases out to a new dataset

 Create a new dataset

7
View the Results

8
For more Tech Tips
visit

www.presidion.com/ibm-spss-technical-tips

www.presidion.com
Talk to us

 info@presidion.com  +44 (0)208 757 8820 (UK)  +353 (0)1 415 0234 (IRL)

You might also like