[Tutor] spss.BasePivotTable

Albert-Jan Roskam fomcl at yahoo.com
Tue Aug 27 15:14:33 CEST 2013


Hello,
 
I am trying to create a BasePivot table with three columns: one for the labels, one for a a category "Before" and one for "After". The following attempt fails, but what am I doing wrong?
 
begin program.
import spss
try:
    spss.StartSPSS()
    #spss.Submit("get file='demo.sav'.")
    spss.StartProcedure("proc")
    table = spss.BasePivotTable("table","mytable")
    table.Append(spss.Dimension.Place.row,"rowdim")
    table.Append(spss.Dimension.Place.column,"coldim1")
    table.Append(spss.Dimension.Place.column,"coldim2")
    value1 = spss.CellText.Number(23,spss.FormatSpec.Count)
    value2 = spss.CellText.Number(24,spss.FormatSpec.Count)
    table[(spss.CellText.String("M"),)] = (value1, value2)
    spss.EndProcedure()
    spss.StopSPSS()
except spss.SpssError:
    print "Error."
print spss.GetLastErrorMessage()
end program.
 
Thank you in advance!

Regards,
Albert-Jan


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a 
fresh water system, and public health, what have the Romans ever done for us?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 


More information about the Tutor mailing list