• Add a Comment
  • Edit
  • More Actions v
  • Quarantine this Entry

Comments (11)

1 OrlandoHughes commented Permalink

On a closely related (but far less clever, Jon) note, and apologies if this has already been covered elsewhere, I have found OUTPUT MODIFY to be very helpful for highlighting standardised residuals in crosstabs. This is something that I would previously have done using VB in Excel. Colours not perfect, but easy to change:

 
*syntax for highlighting standardised residuals on crosstabs, output window only.
OUTPUT MODIFY
/REPORT PRINTREPORT=YES
/SELECT TABLES
/IF COMMANDS=[LAST]
/TABLECELLS SELECT=[RESIDUALS] SELECTDIMENSION=ROWS SELECTCONDITION="-1.96<x><1.96"
REVERTTODEFAULT=YES APPLYTO=CELL
/SELECT TABLES
/IF COMMANDS=[LAST]
/TABLECELLS SELECT=[RESIDUALS] SELECTDIMENSION=ROWS SELECTCONDITION="x<=-1.96" STYLE=REGULAR BOLD
BACKGROUNDCOLOR=RGB(172, 208, 238) APPLYTO=CELL
/SELECT TABLES
/IF COMMANDS=[LAST]
/TABLECELLS SELECT=[RESIDUALS] SELECTDIMENSION=ROWS SELECTCONDITION="x<-2.58" STYLE=REGULAR BOLD
BACKGROUNDCOLOR=RGB(122, 170, 213) APPLYTO=CELL
/SELECT TABLES
/IF COMMANDS=[LAST]
/TABLECELLS SELECT=[RESIDUALS] SELECTDIMENSION=ROWS SELECTCONDITION="x<-3.29" STYLE=REGULAR BOLD
BACKGROUNDCOLOR=RGB(93, 97, 255) APPLYTO=CELL
/SELECT TABLES
/IF COMMANDS=[LAST]
/TABLECELLS SELECT=[RESIDUALS] SELECTDIMENSION=ROWS SELECTCONDITION="x>=1.96" STYLE=REGULAR BOLD
BACKGROUNDCOLOR=RGB(112, 220, 132) APPLYTO=CELL
/SELECT TABLES
/IF COMMANDS=[LAST]
/TABLECELLS SELECT=[RESIDUALS] SELECTDIMENSION=ROWS SELECTCONDITION="x>2.58" STYLE=REGULAR BOLD
BACKGROUNDCOLOR=RGB(46, 184, 72) APPLYTO=CELL
/SELECT TABLES
/IF COMMANDS=[LAST]
/TABLECELLS SELECT=[RESIDUALS] SELECTDIMENSION=ROWS SELECTCONDITION="x>3.29" STYLE=REGULAR BOLD
BACKGROUNDCOLOR=RGB(13, 141, 70) APPLYTO=CELL.
 
(And that's it. Very handy.)</x>

2 JonPeck commented Permalink

Here is something similar I did with the SPSSINC MODIFY TABLES extension command, Although it is not as elaborate as your example. Conditional formatting can be a great tool for helping to convey the message in the output.

 
SPSSINC MODIFY TABLES SUBTYPE='Crosstabulation'
DIMENSION=ROWS SELECT='Std. Residual'
/STYLES TEXTSTYLE=BOLD BACKGROUNDCOLOR=255 0 0
APPLYTO='abs(x) >2'.
 
The popularity of MODIFY TABLES was a big reason that we implemented the easier to use OUTPUT MODIFY native command.

3 GregDoane commented Permalink

I'm using similar CTABLES output with the comparison of column proportions and column means secondary tables.

 
I have Python code that isn't working where I'm attempting to delete (or hide) these pivot tables before exporting the other tables to a PDF file.
 
Do you have any ideas why? My code block is below:
 
try:
 
MyOutputDocLists = SpssClient.GetOutputDocuments()
 
MyOutputDoc = SpssClient.GetDesignatedOutputDoc()
 
MyOutputItems = MyOutputDoc.GetOutputItems()
 
#MyOutputDoc.ClearSelection()
 
pTable = 0
 
for index in range(MyOutputItems.Size()):
 
OutputItem2 = MyOutputItems.GetItemAt(index)
 
MyItemType = OutputItem2.GetType()
 
MySpecificType = OutputItem2.GetSpecificType()
 
if OutputItem2.GetType() == SpssClient.OutputItemType.PIVOT:
 
MyPivotTable = OutputItem2.GetSpecificType()
 
sTitle = MyPivotTable.GetTitleText()
 
if ('Comparisons of Column' in sTitle):
 
OutputItem2.SetSelected(True)
 
print "yes"
 
else:
 
if pTable > 0:
 
OutputItem2.SetPageBreak(True)
 
pTable += 1 #OutputItem2.SetSelected(True)
 
 
 
MyOutputDoc.Delete()
 
Thanks in advance!
 
Greg

4 JonPeck commented Permalink

Please repost. the html mangling makes it pretty hard to decipher the code. It would be better to post this in the forums.

5 nicodw commented Permalink

Hi Jon, very interesting and usefull!. Used it many times.Thanks
I was wondering if it is possible to do this coloring on an already merged table (using CT ... merge= yes), where the significances are marked by subscript letters (a, b, c)

6 JonPeck commented Permalink

There is a function
colorIfEndsWithAtoZLetter
in the customstylefunctions.py module included with MODIFY TABLES that you can use for this purpose. That module also has boldIfEndsWithAtoZLetter

7 nicodw commented Permalink

Thanks Jon
i'll give it a try

8 mikeCola commented Permalink

Jon - The MERGE TABLES and MODIFY TABLES functionality work great. I was able to move the sig testing letter to the data table and apply cell shading similar to your example above. However, I'm running into trouble when I change my SLABELS POSITION from COLUMN to ROW. (We usually show multiple statistics. Our end clients prefer displaying in rows vs. columns.) I tried changing the attachment point by selecting Dimension=Row in the Merge Viewer table dialog with no luck. I noticed it states in the help menu that "Some kinds of tables cannot be merged. Some experimentation may be necessary." Is this one of those instances where the table cannot be merged? Any suggestions would be greatly appreciated.

9 NejcR commented Permalink

Hey! Does anyone know how to program colored significant correlations?

10 JonPeck commented Permalink

Dressing up correlation tables is a popular request. if you have installed MODIFY TABLES, then also install FormatCorrelations via the Utilities menu in V22 or later or download from this site from the Extension Commands collection.

 
Then you will see on the Utilities menu an entry for Format Correlation Matrix. It can hide insignificant correlations, highlight large correlations, hide the upper triangle, and other things.
 
If you have questions, it is best to post them in the SPSS forums as the blog contents are not always seen promptly.

Add a Comment Add a Comment