OVERWRITE VALUES command
See Crunch Automation basics for more information.
The OVERWRITE VALUES command allows you to modify specific values in categorical or numeric variables by replacing all rows in a dataset regardless of the applied exclusion filter.
This command only allows you to overwrite using values that exist on the definition of the current variables. It does NOT let you alter the categories or replace with values that are not previously allowed.
Optional modifier
The EACH MISSING modifier can be used instead of providing a logical expression. When used, it will be evaluated independently for each of the mentioned variables as if they were cast as multiple OVERWRITE VALUES with an is_missing(variable) expression command.
OVERWRITE (NUMERIC|CATEGORICAL) VALUES alias, ..., alias
WITH {string|code|number|NULL}
[WHEN (expression|EACH MISSING)];
Example
OVERWRITE CATEGORICAL VALUES age, birthyr WITH "No Data" WHEN is_missing(caseid);
OVERWRITE NUMERIC VALUES grade WITH 0 WHEN grade < 0;
# Using subvariables_of() evaluates independent subvariables, not the array:
OVERWRITE CATEGORICAL VALUES subvariables_of(my_array), subvarX, variable WHEN EACH MISSING;
# Using an array variable, is equivalent to using is_missing(array) which evaluates
# True when all subvariables in the array are missing:
OVERWRITE CATEGORICAL VALUES my_array1, my_array2 WHEN EACH MISSING