Missing-Value functions (COMPUTE command)
MISSING VALUE V1 V2 V3 (0).
COMPUTE AllValid=V1 + V2 + V3.
COMPUTE UM=VALUE(V1) + VALUE(V2) + VALUE(V3).
COMPUTE SM=SYSMIS(V1) + SYSMIS(V2) + SYSMIS(V3).
COMPUTE M=MISSING(V1) + MISSING(V2) + MISSING(V3).
- The
MISSING VALUE
command declares the value 0 as missing for V1, V2, and V3. - AllValid is the sum of three variables only for cases with valid values for all three variables. AllValid is assigned the system-missing value for a case if any variable in the assignment expression has a system- or user-missing value.
- The
VALUE
function overrides user-missing value status. Thus, UM is the sum of V1, V2, and V3 for each case, including cases with the value 0 (the user-missing value) for any of the three variables. Cases with the system-missing value for V1, V2, and V3 are system-missing. - The
SYSMIS
function on the thirdCOMPUTE
returns the value 1 if the variable is system-missing. Thus, SM ranges from 0 to 3 for each case, depending on whether the variables V1, V2, and V3 are system-missing for that case. - The
MISSING
function on the fourthCOMPUTE
returns the value 1 if the variable named is system- or user-missing. Thus, M ranges from 0 to 3 for each case, depending on whether the variables V1, V2, and V3 are user- or system-missing for that case. - Alternatively, you could use the
COUNT
command to create the variables SM and M.* Test for listwise deletion of missing values. DATA LIST /V1 TO V6 1-6. BEGIN DATA 213 56 123457 123457 9234 6 END DATA. MISSING VALUES V1 TO V6(6,9). COMPUTE NotValid=NMISS(V1 TO V6). FREQUENCIES VAR=NotValid.
-
COMPUTE
determines the number of missing values for each case. For each case without missing values, the value of NotValid is 0. For each case with one missing value, the value of NotValid is 1, and so on. Both system- and user-missing values are counted. -
FREQUENCIES
generates a frequency table for NotValid. The table gives a count of how many cases have all valid values, how many cases have one missing value, how many cases have two missing values, and so on, for variables V1 to V6. This table can be used to determine how many cases would be dropped in an analysis that uses listwise deletion of missing values. For other ways to check listwise deletion, see the examples for theELSE
command (in theDO IF
command) and those for theIF
command.
See the topic Missing value functions for more information.