spss.GetCaseCount Function (Python)
spss.GetCaseCount(). Returns the number of cases (rows) in the active dataset. Returns a value of -1 if the case count is not known.
Example
#build SAMPLE syntax of the general form:
#SAMPLE [NCases] FROM [TotalCases]
#Where Ncases = 10% truncated to integer
TotalCases=spss.GetCaseCount()
NCases=int(TotalCases/10)
command1="SAMPLE " + str(NCases) + " FROM " + str(TotalCases) + "."
command2="Execute."
spss.Submit([command1, command2])