SELECT IF expression.
SELECT IF selects cases for analysis based on the value of
expression. Cases not selected are permanently eliminated
from the active dataset, unless
TEMPORARY is in effect
Specify a boolean expression (see Mathematical Expressions). If the value of the expression is true for a particular case, the case is analyzed. If the expression has a false or missing value, then the case is deleted from the data stream.
SELECT IF as early in the command file as
possible. Cases that are deleted early can be processed more
efficiently in time and space.
Once cases have been deleted from the active dataset using
SELECT IF they
cannot be re-instated.
If you want to be able to re-instate cases, then use
FILTER (see FILTER)
A shop steward is interested in the salaries of younger personnel in a firm.
The file personnel.sav provides the salaries of all the workers and their
dates of birth. The syntax in Example 13.1 shows how
SELECT IF can
be used to limit analysis only to those persons born after December 31, 1999.
get file = 'personnel.sav'. echo 'Salaries of all personnel'. descriptives salary. echo 'Salaries of personnel born after December 31 1999'. select if dob > date.dmy (31,12,1999). descriptives salary.
From Result 13.1 one can see that there are 56 persons listed in the dataset, and 17 of them were born after December 31, 1999.
Salaries of all personnel
Salaries of personnel born after December 31 1999
Note that the personnel.sav file from which the data were read is unaffected. The transformation affects only the active file.