1. Printing
  2. Working with Many Files
  3. Output Document
  4. Transform variable
  5. Autoscripts
  6. Long variable names
  8. Data Editor
  9. Utilities
  10. Dialogs
  11. Distributions
  12. Export & Import
  13. Labels, Variable Names and Format
  14. Matrix
  15. Syntax Editor
  16. Output format
  17. Manipulating Pivot Tables
Show me data and I will show you data errors!



  1. Print all spo files in a given folder
  2. Print current syntax with file path, date, time and page (It is convenient to attach that script to a new toolbar button in the script window)
  3. Print data filename and path as part of output footer
  4. Print options (this is called by next syntax)
  5. Print options.sps (from AnswerNet)
  6. Print orientation (Add heading, date, time, page numbers to printout)
  7. Set Parameters for Printing via Syntax
  8. Toggle display of page numbers in Output window

Working with Many Files

  1. Combine all .sav files in the given (only file path and mask is supplied, script does the rest… The resulting sav file contains a variable identifying the source file of each case)
  2. Combine all sav or text files in given folder This is a generalization of the preceding script, this one combines either sav or txt files. A variable in the final file contains the name of the file where the case comes from. Of course the DATA LIST commands must be adapted to each particular situation.
  3. Convert all files in folder into other formats Can convert from 
    *sav to *.por
    *.por to *.sav
    *.sav to *.xls
  4. Create as many sav files as there are txt files
  5. List all files in given folder
  6. Run Same Syntax on 17 Zipped Files

Output Document

  1. Empty designated output window
  2. Delete statistics and case processing summary
  3. Break output file into smaller pieces (AnswerNet)
  4. Add page breaks at selected places (an easy to use script to automatically insert page breaks before any specified pivot tables).
  5. Change label title of last run procedure (With thanks to Michael Wexler)
  6. Create new Output with a given filename and file path
  7. Data footer (sets footer of Output to name and path of .sav file)
  8. Extract Information From a Text Output (script used by syntax)
  9. Extract Information From a Text Output (syntax that uses script)
  10. Insert a text object into the SPSS Viewer
  11. Produce a Table of Content (TOC) listing all pivot tables
  12. Remove page breaks
  13. Replace left pane PageTitle by content of right pane (Useful to help locate given areas of the output navigator)
  14. Save Current Output Windows (script used by syntax)
  15. Save Current Output Windows (syntax that uses script)
  16. Save current output window-by script
  17. Search label in Output Window
  18. Select last table in current output
  19. Write index in output navigator
  20. Add footnotes to every Pivot Tables
  21. Demo of script work to add page breaks

Transform variable

  1. Define missing for all numeric variables
  2. Standardize within case


  1. Debugging Automation
  2. Bold Total in SUMMARIZE table or insert Page Break This is an example of a syntax which passes an argument to an autoscript. This can be very useful.
  3. Bold Total In SUMMARIZE table Or Insert Page Break

Long variable names

  1. Rename Long to Short These scripts allow switching between long and short variable names (used with syntax).
  2. Short .por-names to Long
  3. Rename Long to Short (syntax that uses script)
  4. Scripts for Switching between short and long variable names


  1. Change bar colors for each IGRAPH bar chart with only an x-axis
  2. Format IGRAPH
  3. Format IGRAPH (this syntax creates data, two graphics then calls the above script)
  4. Export All IGRAPH to Jpeg of a given size
  5. Export current IGRAPH to Jpeg of a given size

Data Editor

  1. Apply String Length This automatically reformats all string variables of any sav file to the format of the string variable having same name in a Template.sav file
  2. Find number of cases (works for weighted and un-weighted files)
  3. Create empty data file with n cases n is supplied by the user at run time)
  4. Display number of variables and cases in data file
  5. Set data editor column width to match variable length
  6. Load data file and print data values in
  7. Split current data file in n random groups (n is supplied by the user at run time)


  1. Running Script from Syntax This is Fabrizio script to circumvent the asynchronous problem. You must ensure that there are no trailing spaces at the end of the syntax.
  2. Automatically run a script or syntax when SPSS starts
  3. Create new output window
  4. Illustrate windows state (how to minimize, maximize a window)
  5. Call script B from script A
  6. Add file date to file names in a given folder
  7. Automatically gets data and output HTML files every hour
  8. Convert syntax into script format (with thanks to Rolf Kjoeller)
  9. Script to run a DOS command or Bat file code by Fabrizio
  10. Levenshtein Distance between 2 strings
  11. Levenshtein Distance Between 2 Strings (syntax that uses script)
  12. Multi purpose script: (run Sub based on syntax call)
  13. Name data file based on date read from data file
  14. Toggle Output Type (with thanks to Karel Asselberghs)
  15. Terminate syntax with period
  16. Write table of content of output navigator to text file
  17. Running Script from Syntax - 2


  1. Get a file name from the user
  2. Get file name from user then define path by macro
  3. Get Fiscal Year from user then run syntax for that year
  4. Get user name then define a usrname macro
  5. Variable list demo1 (from SPSS site)
  6. Variable list demo2 (from SPSS site)
  7. Variable list demo3 (from SPSS site)
  8. Empty Designated Draft Output


  1. Distribution plot
  2. Generate Random Variables with thanks to Kirill Orlov. Creates random variables with various options (eg correlated, rounded, with missing values etc)
  3. Distribution

Export & Import

  1. Export pivot table data cells to data editor
  2. Export labels from MS Access to SPSS This is Visual Basic code.
  3. Save all attachments of emails to a given folder (This is an Outlook VB Script) all emails in a given Outlook folder are processed)
  4. Send a document as an attachment to an email This SaxBasic script uses Outlook 2000 to send an email to a recipient with an attachment, the attachment could be an HTML page produced by SPSS, and spo file or any other documents.
  5. Convert to Excel 5_95 format SPSS exports to Excel 2.1; this automatically converts the file to Excel 5/95 format.
  6. Export tables to a single excel sheet
  7. Export tables to a single excel sheet v2 This exports then groups the lines forming a table. Very convenient.
  8. ExportTablesToSingleExcelSheetV3 Similar to above script however this one also exports CHARTS and IGRAPHS.
  9. ExportTablesToSingleExcelSheetV4 As an improvement to V3, this one exports all layers of Pivot Tables.
  10. Export Pivot Tables to PowerPoint
  11. Change background color of all IGRAPHs in Viewer
  12. Export all pivot tables of all spo files to HTM file (only spo files meeting a given path and file mask are processed. One HTM file is created per SPO file).
  13. Export target items of all spo files to HTM file (this is an extension of above script. This one handles IGRAPH in addition to Pivot Table and Charts)
  14. Export Data Dictionary to text files With thanks to Jean-francois Allaire)
  15. Export Pivot Tables to Word2 (original by SPSS, modified by John Hendrickx to format tables)
  16. Export sav file to free format
  17. Export visible output to word via HTML v2 (here the graphs are embedded in the word document)
  18. Export content of data editor to XML format v2 (This version is for SPSS version 11 and up). (See the above note)
  19. Export spss Output viewer to XML
  20. Export to Triple-S (this script creates a Triple-S v1.2 XML file and related data file from the current SPSS data file). Thanks to the author Chris Johnson for sending it.
  21. Export Data from SPSS to Pulsar Beta 0.16 (with thanks to Alexander Bougakov). This is based on the above script by Chris Johnson.
  22. Add or Update Data from Excel to PowerPoint Chart This is archive with VB .NET program
  23. From SPSS to STATA

Labels, Variable Names and Format

  1. Add extension to all variable names
  2. Add the word "index" at the beginning of all variable labels
  3. Add value labels
  4. Add value labels using a loop
  5. Add variable name at beginning of variable label
  6. Assign variable label equal to variable name (can also be done with syntax)
  7. Capitalise variable and value labels
  8. Define macro calls for each value label Example2 (This is a useful programming tool)
  9. Define macros giving variable labels (can also be done with syntax)
  10. Delete value labels of all variables
  11. Export variable and value labels to txt files (thanks to Wouter Egberink for sending me this code)
  12. Export variable name and variable labels to text file
  13. Populate variable with value labels of another variable (can also be done with syntax)
  14. Reverse autorecode To create a new string variable containing the value labels of an existing variable (this can also be done using syntax alone)
  15. Reverse auto recode10 Use this version for SPSS v10 and over.
  16. Scripts for Switching between short and long variable names


  1. Maximizing the trace of a matrix This is high powered stuff. Need to test all permutations of rows in order to find the one which maximizes the trace. For a 7*7 matrix (the maximum size this macro will handle), there are 5,040 permutations to test.

Syntax Editor

  1. Close All Syntax Doc
  2. Convert Syntax To Script
  3. Find and replace block of text in syntax window
  4. Paste text at the end of syntax window
  5. Run Designated Syntax in Batch Mode I find this very useful, for convenience associate it to a custom made button on your syntax toolbar. Click the button when you want the Designated Syntax to run up to the first error.
  6. Write syntax file defining variable and value labels

Output format

  1. Apply autofit
  2. Apply Table look to all output
  3. Change pivot table text (This is useful to change column or row labels from English to other languages)
  4. Frequencies footnote
  5. Size labels to avoid line-wrapping

Manipulating Pivot Tables

  1. Mark Significance Levels in Tables
  2. Set number decimals of percentages in PivotTable
  3. Undo percent notation
  4. Remove pivot table row and column labels
  5. Applying any script to all pivot tables
  6. Automation of pivotting (Examples to learn how to manipulate layers, columns and rows)
  7. Autoscript to format correlation table (this removes upper diagonal, highlights significant correlations, moves N's and Sig's to the Layer's dimension to hide them) With thanks to Ferd Britton)
  8. Change Format Means Report (script used by syntax)
  9. Change Format Means Report (syntax that uses script)
  10. Change Sig to P
  11. Combine mean and SD (called from this syntax)
  12. Combine Mean and SD
  13. Create pivot table
  14. Crop and retain (Thanks to Mark Baxter)
  15. Cycling through all layers of a table
  16. Define customized crosstab titles Note: to avoid asynchronous problem, the script could be modified to check all documents in the Output window. The script would then be called only once.
  17. Delete footnotes of all Pivot Tables
  18. Exchange rows and columns of Pivot Table
  19. Hide valid and valid percentage in frequency table
  20. Hide a column in pivot table
  21. Highlights significant cells of all ANOVA tables in Designated Viewer This is an example of Applying a script to all (ANOVA) pivot tables in the Designated Viewer.
  22. Highlight significant T-Test cells
  23. Italize percentages in PivotTable
  24. Left right or center justify title of all pivot tables
  25. Create pivot table-ROC (called from this syntax)
  26. Create pivot table-ROC
  27. Make totals bold This applies only to the currently selected Pivot Table. Can also change the color of applicable cells.
  28. Make Totals Bold All Pivot Tables Similar to the above script but applies to all visible Pivot Tables in the Designated Viewer
  29. Pivoting to each layer of a pivot table
  30. Remove percent signs from PivotTable
  31. Replacing Empty Cells of Pivot Tables by user-defined characters
  32. Rotate inner labels of all visible PivotTables
  33. Round frequencies in crosstab tables
  34. Reverse columns order
  35. Ungroup a column in a pivot table
  36. Set number of decimals in pivot table
  37. Substitute string in pivot tables
  38. Table Widths (syntax that uses script)
  39. Table Widths (Thanks to Jason Burke for this improved version). This is script, used by syntax
  40. Undo Scientific (##.#E±##) Notation (standard procedure from file Global.SBS)
  41. Traffic Light
  42. Traffic Light with Fixed Margins 15 and 25
  43. Traffic Light with 3 Cut Off Points
  44. Autoscript to format correlation table (adapted for SPSS versions 16+)