Return list with opened datasets
1 2 3 4 5 6 7 8 9 10 11 12 | def GetListOfDatasets(): #this is because the spss fuctnion getDatasets did not work
"""Return list with opened datasets.
"""
cmd = """DATASET DISPLAY."""
handle,failcode=spssaux.CreateXMLOutput(cmd,'Dataset Display','Datasets',False)
if failcode<>0:
return None #something went wrong
listDS = spssaux.GetValuesFromXMLWorkspace(tag=handle,tableSubtype='Datasets',hasCols=False)
spss.DeleteXPathHandle(handle)
return listDS
|
I tried spss.GetDatasets() but was not able to get it running. It was always returning None (even I used it within the block "with spss.DataStep()")
So I created simple replacement to the given function which someone may find useful too.