CLASSIFY <data>,<classification>,<input_variable>,<output_variable>
computes the values of <output_variable> as a function of <input_
variable> in Survo <data> according to a given <classification>.
Specifications IND and CASES can be used for selecting observations.
<classification> has to be defined in the following form:
CLASSIFICATION <classification>
<values_of_input_variable>: <value_of_output_variable>
<values_of_input_variable>: <value_of_output_variable>
...
END
<input_variable> and <output_variable> can be numeric or string
variables. If <output_variable> does not exist, a new variable will be
automatically created.
Examples on classification rules:
CLASSIFICATION NUMBERS
1,3,5,7,9: odd
0,2,4,6,8: even
OTHERS: SAME
END
maps values 1,3,5,7 and 9 to 'odd' and 0,2,4,6 and 8 to 'even'.
Other values (OTHERS) will be the same (SAME).
CLASSIFICATION C1
0,99,MISSING: MISSING
11 - 20: 1
21 - 40: 2
OTHERS: 3
END
classifies values 0,99 and missing values of <input_variable> as
missing values, values from 11 to 20 as 1, values from 21 to 40 as 2
and all other values as 3.
Examples (continued):
Special features when the source field is a string:
CLASSIFICATION C2
M1,M2,M31: A
M3 - M6: B
M7: C
END
maps values of a string variable. For example, M315 -> A, but M302 -> B.
Thus if the alternatives overlap, the first valid case is selected.
To indicate space characters in the CLASSIFICATION list, any character
(say _) can be selected by entering a specification SPACE=_ .
Then, for example,
CLASSIFICATION C3
___: 0
A__,_A_,__A: 1
AA_,A_A,_AA: 2
AAA: 3
END
gives the number of `A's in a three-character string field. The true
values of that string field are assumed to be
" ", "A ", " A ", " A", "AA ", "A A", " AA", "AAA".
Wild characters are accepted by giving a specification WILD=? .
For example, the line
A??: 1
in the CLASSIFICATION list implies that any three letter string
starting with A is mapped to 1.
Similarly, partial matches are indicated by giving a specification
PARTIAL=*
Then, for example, the line
*DOS: 2
in the CLASSIFICATION list maps all cases where DOS appears as
a substring to 2.
Alternatives for OTHERS in the CLASSIFICATION list are
value of <output_variable>
OTHERS: MISSING missing value
OTHERS: SAME equal to <input_variable>
OTHERS: NO_CHANGE remains unchanged
V = More information on transformations