- Boldface Absolute Correlations > 0.5
- Set Decimal Places for Output Tables
- Transpose One or Many Output Tables
- Delete Selection of Output Items
- Set Font Sizes and Styling for Output Tables
- 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.
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:
- manually: most properties of output items can be edited after double-clicking them.For some adjustments, this is still the only reasonable way to go. This is better avoided since it is very time consuming and not replicable.
- SPSS scripting: unknown to many users, SPSS includes a scripting language known as SaxBasic which is related to VBA. SPSS scripting has been deprecated in favor of Python introduced in SPSS version 14.
- Python scripting: the most powerful option to edit basically anything in the output viewer may require a steep learning curve. If OUTPUT MODIFY doesn't get it done, Python-scripting probably will.
Instead of using OUTPUT MODIFY, you may also edit output items before creating them:
- Variable formats -set with FORMATS or ALTER TYPE- mostly dictate how statistics show up in output tables.
- You can apply styling to charts by setting a chart template before creating them. Applying chart templates after creating charts -manually, with Python scripting or with OUTPUT MODIFY- is usually less convenient.
- For creating prettier tables, set a tablelook before creating your tables. Again, you can apply table templates after creating tables but that's often less handy.
- OMS can prevent the creation of output items altogether. An example is the often undesired “Case processing summary” table that comes with CROSSTABS.
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.
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 navigating to
Our second option is to select after right-clicking an output item. In either case, we'll first get the output selection dialog shown below.
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
opens the main dialog.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 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
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
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.
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.
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
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
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
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
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
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
(only available in the output window).
Alternativey, clean up your output window and convert everything 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.
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
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.
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
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
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!
THIS TUTORIAL HAS 17 COMMENTS:
By Eli Kleinberger on July 25th, 2023
Your tutorial is (as usual) excellent and gives me a good start. What would also help immensly is if there were a full list of all the changes possible to do with this command?
By Ruben Geert van den Berg on July 26th, 2023
Hi Eli, nice to hear from you!
However, I'm not going to work on this any time soon.
First off, most SPSS users find OUTPUT MODIFY too much of a challenge, even though it is a tremendous time saver. So for me, the audience is too small to justify investing lots of time in it.
Second, this command is still being expanded significantly so updates will quicly be outdated again. Most interesting is the ability to rearrange table pivots to some extent.
A lovely example (pasteable from the CROSSTABS menu under cells) are APA style contingency tables. I previously used a Python script for that but OUTPUT MODIFY is faster and more reliable.
Keep up the good work!
Ruben
SPSS tutorials