spss.BasePivotTable Class (Python)

spss.BasePivotTable(title,templateName,outline,isSplit,caption). Provides the ability to create custom pivot tables that can be displayed in the IBM® SPSS® Statistics Viewer or written to an external file using the IBM SPSS Statistics Output Management System.

  • The argument title is a string that specifies the title that appears with the table. Each table associated with a set of output (as specified in a StartProcedure-EndProcedure block) should have a unique title. Multiple tables within a given procedure can, however, have the same value of the title argument as long as they have different values of the outline argument.
  • The argument templateName is a string that specifies the OMS (Output Management System) table subtype for this table. It must begin with a letter and have a maximum of 64 characters. Unless you are routing this pivot table with OMS, you will not need to keep track of this value, although you do have to provide a value that meets the stated requirements.

    Note: Specifying "Warnings" for templateName will generate an IBM SPSS Statistics Warnings table. Unless you want to generate an IBM SPSS Statistics Warnings table, you should avoid specifying "Warnings" for templateName. See the topic Creating a Warnings Table (Python) for more information.

  • The optional argument outline is a string that specifies a title, for the pivot table, that appears in the outline pane of the Viewer. The item for the table itself will be placed one level deeper than the item for the outline title. If omitted, the Viewer item for the table will be placed one level deeper than the root item for the output containing the table.
  • The optional Boolean argument isSplit specifies whether to enable split processing when creating pivot tables from data that have splits. By default, split processing is enabled. To disable split processing for pivot tables, specify isSplit=False. If you are creating a pivot table from data that has splits and you want separate results displayed for each split group, you will want to make use of the spss.SplitChange function. In the absence of calls to spss.SplitChange, isSplit has no effect.
  • The optional argument caption is a string that specifies a table caption.

An instance of the BasePivotTable class can only be used within a StartProcedure-EndProcedure block or within a custom procedure class based on the spss.BaseProcedure class. For an example of creating a pivot table using spss.StartProcedure-spss.EndProcedure, see Creating Pivot Tables with the SimplePivotTable Method (Python) . For an example of creating a pivot table using a class based on the spss.BaseProcedure class, see spss.BaseProcedure Class (Python) .

The figure below shows the basic structural components of a pivot table. Pivot tables consists of one or more dimensions, each of which can be of the type row, column, or layer. In this example, there is one dimension of each type. Each dimension contains a set of categories that label the elements of the dimension--for instance, row labels for a row dimension. A layer dimension allows you to display a separate two-dimensional table for each category in the layered dimension--for example, a separate table for each value of minority classification, as shown here. When layers are present, the pivot table can be thought of as stacked in layers, with only the top layer visible.

Each cell in the table can be specified by a combination of category values. In the example shown here, the indicated cell is specified by a category value of Male for the Gender dimension, Custodial for the Employment Category dimension, and No for the Minority Classification dimension.

Figure 1. Pivot table structure
Pivot table structure