'Begin Description 'This script changes "Sig." to "p=" in the column labels of any pivot table. 'Requirement: The Pivot Table that you want to change must be selected. 'End Description 'PURPOSE 'This script changes "Sig." to "p=" in the column labels of any pivot table 'ASSUMPTIONS 'A pivot table that contains "Sig." in one or more column labels is selected in the Navigator. 'Also, the Navigator (Output Document) that contains the Pivot Table is the Designated Output Window 'EFFECTS 'Changes "Sig." to "p=" in the column labels of any pivot table 'HINTS 'If you are new to programming, select Scripting Tips from the 'Help menu for a basic introduction. 'For information on SPSS automation objects, properties and methods, 'press F2 to display the Object Browser. 'For context-sensitive help on Sax Basic terms as well as SPSS objects, 'properties, and methods, press F1. Option Explicit 'All variables must be declarated before being used 'Script level constant declarations Const cSIG As String = "Sig." Const cP_EQUAL As String = "p=" '*********************************************************************** Sub Main 'Declare variables here Dim objPivotTable As PivotTable Dim objItem As ISpssItem Dim bolFoundOutputDoc As Boolean Dim bolPivotSelected As Boolean 'The following procedure is a global procedure that is located in global.sbs Call GetFirstSelectedPivot(objPivotTable, objItem, bolFoundOutputDoc, bolPivotSelected) If (bolFoundOutputDoc = False) Or (bolPivotSelected = False) Then 'either there wasn't an output doc or a pivot table wasn't selected Exit Sub End If Call CrosstabsSigToP(objPivotTable) 'CrosstabsSigToP changes "Sig." to "p=" objItem.Deactivate End Sub '********************************************************************** Sub CrosstabsSigToP(objPivotTable As PivotTable) 'Purpose: Changes column label that refer to significance 'Assumptions: A Pivot Table that contains "Sig." in one of the column labels is selected 'Effects: Any column label containing "Sig." will be replaced with "p=" 'Inputs: Selected Pivot Table 'Return Values: The Pivot Table with changed column labels 'Declare SPSS-specific objects Dim objColLabels As ISpssLabels 'Declare various integer indices Dim lngRowNum As Long Dim lngColNum As Long Dim lngNumCols As Long Dim lngNumRows As Long Set objColLabels = objPivotTable.ColumnLabelArray() lngNumCols = objColLabels.NumColumns lngNumRows = objColLabels.NumRows 'Check the last label in each row of column labels For lngRowNum = 0 To lngNumRows - 1 For lngColNum = 0 To lngNumCols - 1 If InStr(objColLabels.ValueAt(lngRowNum,lngColNum), cSIG) > 0 Then objColLabels.ValueAt(lngRowNum,lngColNum) = cP_EQUAL End If Next lngColNum Next lngRowNum End Sub '*******************************************************************