I'm trying to retrieve data from my SPSS output in python, so i can modify the data and write it to excel. I've got no problem retrieving the data from a descriptives table using the following code:
import spssaux
variables = 'Age'
vDict = spssaux.VariableDict(caseless=True)
vList = vDict.expand(variables)
cmd = spssaux.CreateXMLOutput('descriptives %s.'%" ".join(vList))
ageMax = spssaux.GetValuesFromXMLWorkspace(cmd,'Descriptive Statistics',colCategory = 'Maximum',cellAttrib = 'number')
ageMax = int(ageMax[0])
print(ageMax)
But when I want to extract data from a frequency table i'm not able to retrieve any data.
I've tried to use the "OMS logic" (names of Table subtype or labels) but still no result. I'm using SPSS Statistics 26.
This is (some of) the code i've tried so far:
import spssaux
variables = 'Age'
vDict = spssaux.VariableDict(caseless=True)
vList = vDict.expand(variables)
cmd = spssaux.CreateXMLOutput('fre %s.'%" ".join(vList))
agePercentage1 = spssaux.GetValuesFromXMLWorkspace(cmd,'Frequencies',colCategory = 'Valid Percent')
agePercentage1 = agePercentage1[0]
print(agePercentage1)
Hopefully somebody can help me.
Kind regards, Bart