spss.GetDatasets Function (Python)

spss.GetDatasets(). Returns a list of the available Dataset objects. Each object in the list is an instance of the Dataset class. The GetDatasets function is intended for use within a data step or a StartProcedure-EndProcedure block and will return an empty list if used elsewhere. Data steps are initiated with the spss.StartDataStep function and are used to create and manage multiple datasets.

Example

import spss
spss.StartDataStep()
# Create a Dataset object for the active dataset
datasetObj1 = spss.Dataset()
# Create a new and empty dataset
datasetObj2 = spss.Dataset(name=None)
datasetNames = [item.name for item in spss.GetDatasets()]
spss.EndDataStep()