|
Hi All I get an error, when looping
through the DataCellArray. The error is: Traceback (most recent call last): File "<string>", line 17, in <module> _SpssClient.SpssClientException: (16619, 'An error occured in the
Pivot Table.', '') Here the code for which the error occurs: TIA for any help. Christian New file. DATASET Close All. data list list /Medi(F8.0) Sex(F8.1) Age(F8.2) . begin data 1 1 44.25 2 1 52.92 1 1 37.21 1 1 60.87 2 1 58.69 2 2 43.17 1 2 44.93 1 1 34.19 1 2 39.96 2 1 63.04 End Data. Var Label Medi 'Treatment'. Val Label Medi 1 'Verum' 2 'Placebo'. Var Label Sex "Gender". Val Label Sex 1 "male" 2 "female". Compute Pat = 1. Var Label Pat "Total". VaL Label Pat 1 " ". CTABLES /FORMAT EMPTY = " " /VLABELS VARIABLES=Medi sex Age DISPLAY=DEFAULT /TABLE Pat [c] [Count " " F8.0] + sex [C] [COUNT "N" F8.0, COLPCT.COUNT "%"
PCT8.1] + Age [s] [VALIDN "Valid" F8.0, MEAN "Mean" F8.2, MAXIMUM "Maximum" F8.2, MINIMUM "Minimum" F8.2, MEDIAN "Median" F8.2, STDDEV "Std.dev." F8.2, PTILE 25 "Percentile 25" F8.2, PTILE 75 "Percentile 75" F8.2] BY Medi [c] /Titles TITLE = "My Table 3" /SLABELS POSITION=ROW /CATEGORIES VARIABLES = Medi ORDER=A KEY=VALUE EMPTY=INCLUDE
TOTAL=YES POSITION=AFTER /CATEGORIES VARIABLES=sex ORDER=A KEY=VALUE EMPTY=INCLUDE. BEGIN PROGRAM. import SpssClient SpssClient.StartClient() OutputDoc = SpssClient.GetDesignatedOutputDoc() OutputItems = OutputDoc.GetOutputItems() for index in range(OutputItems.Size()): OutputItem = OutputItems.GetItemAt(index) if OutputItem.GetType() == SpssClient.OutputItemType.PIVOT: if OutputItem.GetSpecificType().GetTitleText().lower()
== "my Table 3".lower() : PivotTable = OutputItem.GetSpecificType() PivotTable.SetUpdateScreen(False) dataCells = PivotTable.DataCellArray() for i in range(dataCells.GetNumRows()): for j in range(dataCells.GetNumColumns()): print dataCells.GetHAlignAt(i, j) dataCells.SetHAlignAt(i,j,4) print "after addig:",
dataCells.GetHAlignAt(i, j) PivotTable.SetUpdateScreen(True) SpssClient.StopClient() END PROGRAM. ********************************** Christian Schmidhauser, Dr.phil.II |
| Free forum by Nabble | Edit this page |
