SPSS tutorials

BASICS DATA ANALYSIS T-TEST ANOVA CHI-SQUARE TEST

SPSS OUTPUT MODIFY – Batch Edit Output Items

  1. Boldface Absolute Correlations > 0.5
  2. Set Decimal Places for Output Tables
  3. Transpose One or Many Output Tables
  4. Delete Selection of Output Items
  5. Set Font Sizes and Styling for Output Tables
  6. Set Exact Sizes for Charts

All examples require SPSS version 22 or higher. We'll use bank_clean.sav -screenshot below- throughout this entire tutorial.

SPSS Output Modify Data View Bank Clean

OUTPUT MODIFY - What and Why?

OUTPUT MODIFY is an SPSS command that edits one or many SPSS output items -mostly tables and charts- by syntax. OUTPUT MODIFY was introduced in SPSS version 22 and -together with Python- is among the most important time savers in SPSS.
OUPUT MODIFY is available from the menu -we'll get to that in a minute- but we recommend copy-paste-editing or just typing the syntax.

Alternatives for OUTPUT MODIFY

Prior to OUTPUT MODIFY there were 3 options for editing output items after creating them:

Instead of using OUTPUT MODIFY, you may also edit output items before creating them:

OUTPUT MODIFY from SPSS’ Menu

Let's first run a quick correlation matrix from the syntax below. Again, we'll use bank_clean.sav throughout this entire tutorial.

*Create clean correlation matrix without N or significance.

factor
/variables q1 to q9
/print correlation.

Let's now try and boldface all absolute correlations > 0.50 by running OUTPUT MODIFY from the menu. Our first option is is navigating to Utilities SPSS Menu Arrow Style Output but this is only present when you're in the output viewer window.
Our second option is to select Style Output after right-clicking an output item. In either case, we'll first get the output selection dialog shown below.

SPSS Output Modify Right Click Output Item

You can now make a selection of output items you'd like to modify. Personally, I think there's too many options here and it's unclear to me what they mean. I find it much easier to make my selection in the syntax. Clicking Continue opens the main dialog.

SPSS Output Modify Main Window

The main OUTPUT MODIFY dialog allows you to specify modifications for elements of your output items. I'll skip the details because -again- I find this easier to do this from syntax. In any case, the best syntax I could paste from the menu is shown below.

OUTPUT MODIFY Example - Pasted from Menu

*OUTPUT MODIFY syntax example pasted from SPSS menu.

OUTPUT MODIFY NAME=Document7
/REPORT PRINTREPORT=NO
/SELECT TABLES
/IF COMMANDS=["Factor Analysis(1)"] LABELS=[EXACT("Correlation Matrix")] INSTANCES=[1]
/DELETEOBJECT DELETE=NO
/OBJECTPROPERTIES VISIBLE=ASIS
/TABLECELLS SELECT=[CORRELATION] SELECTDIMENSION=COLUMNS SELECTCONDITION="Abs(x)>=0.5"
    STYLE=REGULAR BOLD APPLYTO=CELL.

OUTPUT MODIFY - Syntax Problems

The syntax we just pasted is utter stupidity because it won't work in most situations; NAME=Document7 restricts the command to an output window named “Document7”. That's where my table resides now but probably not tomorrow when I continue working on my project. Let alone when a colleague or client tries to replicate my work. This defeats the whole point of working from syntax in the first place.
Furthermore, the syntax is way too long and complex to write manually but most of it does absolutely nothing. Now, most things in SPSS -including OUTPUT MODIFY- are best done by writing simple, clean syntax. Sadly, this pasted syntax is a very poor example for doing so. This goes for many other commands as well.
Last, "Abs(x) ≥ 0.5" includes the diagonal elements because abs(1.000) > 0.5. What I need is something like "Abs(x) ≥ 0.5 & Abs(x) < 1". I tried to accomplish this from the menu. I failed.
In short, I think the pasted syntax sucks like hell and I don't like the OUTPUT MODIFY dialogs either. So let's now study some examples that get things done the right way.

1. Boldface Correlations > 0.5

*Create clean correlation matrix without N or significance.

factor
/variables q1 to q9
/print correlation.

*Boldface absolute correlations > 0.5.

output modify
/select tables
/if commands = ['factor analysis'] subtypes = ['Correlation Matrix']
/tablecells select = [body] selectcondition = ["0.5 < abs(x) < 1"] style = bold.

Result

SPSS Conditional Formatting With Output Modify Example

Notes

For processing all tables in the active output window, just use OUTPUT MODIFY
/SELECT TABLES...
Optionally, specify some conditions by adding an /IF subcommand as in OUTPUT MODIFY
/SELECT TABLES
/IF COMMANDS = ['FACTOR ANALYSIS']
Only tables that satisfy all conditions are processed. Confusingly, COMMANDS does not refer to the commands that created the output -FACTOR in this example.
Instead, COMMANDS refers to the OMS command identifiers which you can copy-paste from the output outline. The same goes for SUBTYPES and LABELS as shown below.

SPSS Copy Oms Command Identifier

Now, the BODY of our table contains just correlations. If we set some condition, we refer to those as x as in x > 0.5 So how to style absolute correlations between 0.50 and 1 (exclusive)? The obvious way seems abs(x) > 0.5 & abs(x) < 1 but it somehow does not work. Instead, 0.5 < abs(x) < 1 does the job. However, it's a rather unusual way to formulate such a condition in SPSS.
Last but not least, OUTPUT MODIFY seems unable to undo the boldfacing exercise. Insofar as I understood, the syntax below should work but it doesn't.

*Try and undo boldfacing (doesn't work).

output modify
/select tables
/if commands = ['factor analysis'] subtypes = ['Correlation Matrix']
/tablecells select = [body] selectcondition = ["0.5 < abs(x) < 1"] style = regular.

2. Set Decimal Places Output Tables - Example I

*Set Decimal Places Output Tables - Example I.

descriptives salary.

*Set format for all cells in last table -whatever that was- to dollar1 (zero decimal places).

output modify
/select tables
/if instances = [last] /*SELECT LAST PIVOT TABLE IN OUTPUT*/
/tablecells select = [body] format = 'dollar1'.

Result

Example of Setting Decimal Places for SPSS Output Tables with the OUTPUT MODIFY Command

Set Decimal Places Output Tables - Example II

*Set Decimal Places Output Tables - Example II.

descriptives q1 to q4.

descriptives q5 to q9.

*Set 2 decimal places for columns 4 and 5 for all descriptives tables in output.

output modify
/select tables
/if commands = ['descriptives'] /*SELECT ALL TABLES IN OUTPUT CREATED BY DESCRIPTIVES COMMAND*/
/tablecells select = [position(4) position(5)] selectdimension = columns format = 'f3.2'.

*Note: "[position(4) position(5)] selectdimension = columns" selects columns 4 and 5.

3. Transpose One or Many Output Tables


*Run 2 basic means tables.

means q1 to q4.

means q5 to q9.

*Transpose only last means table but not case processing summary.

output modify
/select tables
/if commands = ['means(last)'] subtypes = ['report'] /* SELECT ONLY "REPORT" (DESCRIPTIVES) TABLE CREATED BY LAST MEANS COMMAND */
/table transpose = yes.

Result

SPSS Output Modify Transpose Tables Example

Notes

This example shows how to create much nicer descriptive statistics tables than using DESCRIPTIVES. Using MEANS instead results in a better table format and allows reporting the median as well as skewness and kurtosis without their standard errors. For more on this, see SPSS DESCRIPTIVES - Problems and Fixes.

4. Delete Selection of Output Items

*Create "big-5" tables.

frequencies gender.

descriptives salary.

crosstabs educ by marit.

means salary by gender.

correlations salary with whours.

*Delete all unwanted tables: "statistics" for frequencies and "case processing summary" for means and descriptives.

output modify
/select tables
/if subtypes = ['case processing summary','statistics']
/deleteobject delete = yes.

Result

SPSS Remove Undesired Tables From Output

Notes

This example comes in very handy if you need to do some “quick and dirty” reporting to a client who doesn't have SPSS installed. In this case, delete all undesired output and convert the entire output document to PDF. You can do so by creating an OUTPUT EXPORT command from File SPSS Menu Arrow Export (only available in the output window).
Alternativey, clean up your output window and convert everyting in one go to an .rtf (rich text format, “WORD”) file. Since this'll include all tables and charts, you can use this as a great starting point for your final report.

5. Set Font Size for Output Tables

Note: this works properly for FREQUENCIES, DESCRIPTIVES and CORRELATIONS and only partly for MEANS and CROSSTABS.

*Create "big-5" tables.

frequencies gender.

descriptives salary.

crosstabs educ by marit.

means salary by gender.

correlations salary with whours.

*Set font sizes to 25 points.

output modify
/select tables
/tablecells select = [body,headers,title] fontsize = 25.

Result

SPSS Set Font Sizes All Tables Output Modify

As we see, OUTPUT MODIFY seems unable to modify corner labels and layer dimensions. A workaround is creating a tablelook that sets a font size for all table elements. Next, OUTPUT MODIFY can apply this template to one, many or all output tables as shown below.

*Set table template with all elements in 15px fonts for all tables.

output modify
/select tables
/table tlook = "C:\Program Files\IBM\SPSS\Statistics\25\Looks\Original-15pt.stt".

*Shorthand if table template resides in default "Looks" folder (such as "C:\Program Files\IBM\SPSS\Statistics\25\Looks\").

output modify
/select tables
/table tlook = "Original-15pt".

*Don't use table template for any tables in output window.

output modify
/select tables
/table tlook = none.

Keep in mind that CD ignores the TLOOK setting, which is very annoying if your clients must replicate things on their own computers. You'll need to use absolute paths here and adjust those each time you move your project folder.
Alternatively, you can use a shorthand if you put your table templates in the default looks folder (such as C:\Program Files\IBM\SPSS\Statistics\24\Looks). However, that's typically where you don't want to develop, store and backup any project files.

6. Set Exact Size for Charts

*Create basic histogram of dates of birth (dob).

frequencies dob
/format notable
/histogram.

*Set chart size to 720 by 300 points (resulted in 964 by 404 points).

output modify
/select charts
/objectproperties size=points(720,300).

Result

SPSS Output Modfiy Set Chart Sizes Not Working

Apparently, OUTPUT MODIFY sets a different chart size than specified. For setting the correct chart sizes, try our SPSS - Set Chart Sizes Tool.

Final Notes

In this tutorial, I tried to cover the most important OUTPUT MODIFY tricks. But I still wonder: “did I miss anything?” If you -the reader- have any additional example(s) I should add to this tutorial, please drop me a comment below. Last but not least:

thanks for reading!

Previous tutorial: SPSS TableLooks – Quick Introduction

Next tutorial: SPSS OMS Tutorial – Creating Data from Output

Let me know what you think!

*Required field. Your comment will show up after approval from a moderator.

This tutorial has 7 comments