SetFetchVarList (Python)
.SetFetchVarList(var). Resets the list of variables to return when reading case data from the active dataset. The argument var is a list or tuple of variable index values representing position in the active dataset, starting with 0 for the first variable in file order.
- This method is available in read or write mode.
Example
DATA LIST FREE /var1 (F) var2 (A2) var3 (F).
BEGIN DATA
11 ab 13
21 cd 23
31 ef 33
END DATA.
BEGIN PROGRAM.
import spss
cur=spss.Cursor()
oneRow=cur.fetchone()
cur.SetFetchVarList([0])
cur.reset()
oneVar=cur.fetchall()
cur.close()
print("One row (case): ", oneRow)
print("One column (variable): ", oneVar)
END PROGRAM.