SetValueChar Method (Python)
.SetValueChar(varName,varValue). Sets the value for the current case for a string variable. The argument varName is a string specifying the name of a string variable. The argument varValue is a string specifying the value of this variable for the current case.
- This method is available in write or append mode.
- The
CommitCase
method must called for each case that is modified. This includes new cases created in append mode.
Example
DATA LIST FREE /var1 (F) var2(F).
BEGIN DATA
11 12
21 22
31 32
END DATA.
BEGIN PROGRAM.
import spss
cur=spss.Cursor(accessType='w')
cur.SetVarNameAndType(['strvar'],[8])
cur.CommitDictionary()
for i in range(cur.GetCaseCount()):
cur.fetchone()
cur.SetValueChar('strvar','row' + str(i+1))
cur.CommitCase()
cur.close()
END PROGRAM.