SetUserMissingInclude Method (Python)
.SetUserMissingInclude(incMissing). Specifies the treatment of user-missing values read from the active dataset. The argument is a Boolean with True specifying that user-missing values be treated as valid. A value of False specifies that user-missing values should be converted to the Python data type None.
- By default, user-missing values are converted to the Python data type None.
- System-missing values are always converted to None.
- This method is available in read or write mode.
In this example, we will use the following data to demonstrate both the default behavior and the behavior when user missing values are treated as valid.
DATA LIST LIST (',') /numVar (f) stringVar (a4).
BEGIN DATA
1,a
,b
3,,
0,d
END DATA.
MISSING VALUES stringVar (' ') numVar(0).
This first BEGIN PROGRAM
block demonstrates the default behavior.
BEGIN PROGRAM.
import spss
cur=spss.Cursor()
print cur.fetchall()
cur.close()
END PROGRAM.
Result
((1.0, 'a '), (None, 'b '), (3.0, None), (None, 'd '))
This second BEGIN
PROGRAM
block demonstrates the behavior when user-missing
values are treated as valid.
BEGIN PROGRAM.
import spss
cur=spss.Cursor()
cur.SetUserMissingInclude(True)
print cur.fetchall()
cur.close()
END PROGRAM.
Result
((1.0, 'a '), (None, 'b '), (3.0, ' '), (0.0, 'd '))