* ======================================================================= * File: any_demo.SPS . * Date: 28-May-2003 . * Author: Bruce Weaver, weaverb@mcmaster.ca . * Notes: Demonstration of two ways to use ANY in a compute statement . * ======================================================================= . DATA LIST LIST /id q1 q2 q3 (4f2.0). BEGIN DATA. 1 3 3 4 2 4 5 5 3 2 4 3 4 5 4 3 5 2 4 2 END DATA. * There are two ways to use the ANY function: * [1] ANY(Variable, list of VALUES) * [2] ANY(VALUE, list of VARIABLES). * I will illustrate these two uses of ANY by computing flags below. compute id45 = any(id,4,5). /* Illustration of first method. compute flag5 = any(5,q1 to q3). /* Illustration of second method. exe. format id45 flag5 (f1.0). var lab id45 'ID in [4,5]' flag5 'Response = 5 on at least 1 question'. val lab id45 flag5 0 '0- No' 1 '1- Yes'. freq id45 flag5. list all. * ======================================================================= .