I began my process with the following code (extracted from the IBM knowledge center).
BEGIN PROGRAM.
import spss
with spss.DataStep():
datasetObj = spss.Dataset(name=None)
datasetObj.varlist.append('numvar')
datasetObj.varlist.append('strvar',1)
datasetObj.varlist['numvar'].label = 'Sample numeric variable'
datasetObj.varlist['strvar'].label = 'Sample string variable'
datasetObj.cases.append([1,'a'])
datasetObj.cases.append([2,'b'])
END PROGRAM.
I pared it down to this...to see if I could understand how it works.
BEGIN PROGRAM.
import spss
with spss.DataStep():
datasetObj = spss.Dataset(name=None)
datasetObj.varlist.append('numvar')
datasetObj.varlist['numvar'].label = 'Sample numeric variable'
datasetObj.cases.append([1])
datasetObj.cases.append([2])
datasetObj.cases.append([28])
END PROGRAM.
The description for spss.DataSet class indicates that it allows one to modify a data set. So to that end I used the following (code below), hoping to append a case with the value of 111 for NewVar. When run, it presents an error message of that "datasetObj = spss.Dataset(name= * )" is invalid. Clearly I don't get it as the information in the knowledge center presents that [Specifying name="*" or omitting the argument will create a Dataset object for the active dataset.] Am I not creating a "DataSet Object"?
BEGIN PROGRAM.
import spss
with spss.DataStep():
datasetObj = spss.Dataset(name= * )
datasetObj.varlist.append('numvar')
datasetObj.cases.append([111])
END PROGRAM.
It is painfully clear I don't know what I am doing.
Any help will be really appreciated.
Thanks.
=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD