spss.GetVariableType Function (Python)

spss.GetVariableType(index). Returns 0 for numeric variables or the defined length for string variables 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.

Example

#create separate strings of numeric and string variables 
numericvars=''
stringvars=''
varcount=spss.GetVariableCount()
for i in range(varcount):
  if spss.GetVariableType(i) > 0: 
    stringvars=stringvars + " " + spss.GetVariableName(i)
  else: 
    numericvars=numericvars + " " + spss.GetVariableName(i)