spss.GetVarMissingValues Function (Python)

spss.GetVarMissingValues(index). Returns the user-missing values for the variable in the active dataset indicated by the index value. The argument is the index value. Index values represent position in the active dataset, starting with 0 for the first variable in file order.

  • The result is a tuple of four elements where the first element specifies the missing value type: 0 for discrete values, 1 for a range of values, and 2 for a range of values and a single discrete value. The remaining three elements in the result specify the missing values.
  • For string variables, the missing value type is always 0 since only discrete missing values are allowed. Returned values are right-padded to the defined width of the string variable.
  • If there are no missing values, the result is (0,None,None,None).
Table 1. Structure of the result
tuple[0] tuple[1] tuple[2] tuple[3]
0 Discrete value or None Discrete value or None Discrete value or None
1 Start point of range End point of range None
2 Start point of range End point of range Discrete value

Example

#List all variables without user-missing values
nomissList=[]
for i in range(spss.GetVariableCount()):
   missing=spss.GetVarMissingValues(i)
   if (missing[0]==0 and missing[1]==None):
      nomissList.append(spss.GetVariableName(i))
if nomissList:
   print("Variables without user-missing values:")
   print('\n'.join(nomissList))
else:
   print("All variables have user-missing values")