REPLACE CATEGORICAL ARRAY CASE command
See Crunch Automation basics for more information.
REPLACE CATEGORICAL ARRAY CASE is a schema-block command that allows you to overwrite values in a categorical array by defining conditions and the new categories or variable to use for those values.
It follows the same rules as the CREATE CATEGORICAL ARRAY CASE command, but there is no support for an ELSE or VARIABLE statements.
All of the conditions must evaluate to masks of the same column width as the variable you are replacing.
Syntax
REPLACE CATEGORICAL ARRAY CASE my_array1
WHEN condition THEN "label" [CODE int [NUMERIC VALUE <float>] [MISSING]]
...
WHEN condition THEN "label" [CODE int [NUMERIC VALUE <float>] [MISSING]]
END;
Example
REPLACE CATEGORICAL ARRAY CASE my_array1
WHEN my_array1 == 1 THEN "NA"
WHEN my_array2 == 3 THEN "Two" CODE 20
END;