Scripting Facility

The scripting facility allows you to automate tasks, including:

  • Opening and saving data files.
  • Exporting charts as graphic files in various formats.
  • Customizing output in the Viewer.

The available scripting languages depend on your platform. For Windows, the available scripting languages are Basic, which is installed with the Core system, and the Python programming language. For all other platforms, scripting is available with the Python programming language.

To use scripting with the Python programming language, you need Python functionality, which is a part of the IBM® SPSS® Statistics product.

Default Script Language

The default script language determines the script editor that is launched when new scripts are created. It also specifies the default language whose executable is used to run autoscripts. On Windows, the default script language is Basic. You can change the default language from the Scripts tab in the Options dialog. See the topic Script options for more information.

Sample Scripts

A number of scripts are included with the software, in the Samples subdirectory of the directory where IBM SPSS Statistics is installed. You can use these scripts as they are or you can customize them to your needs.

To Create a New Script

  1. From the menus choose:

File > New > Script

The editor that is associated with the default script language opens.

To run a Script

  1. From the menus choose:

    Utilities > Run Script...

  2. Select the script that you want.
  3. Click Run.

Python scripts can be run in a number of ways, other than from Utilities>Run Script. See the topic Scripting with the Python Programming Language for more information.

To Edit a Script

  1. From the menus choose:

    File > Open > Script...

  2. Select the script that you want.
  3. Click Open.

The script is opened in the editor that is associated with the language in which the script is written.