Introduction: A Guide to Command Syntax

The Command Syntax Reference is arranged alphabetically by command name to provide quick access to detailed information about each command in the syntax command language. This introduction groups commands into broad functional areas. Some commands are listed more than once because they perform multiple functions, and some older commands that have been deprecated in favor of newer and better alternatives (but are still supported) are not included here. Changes to the command syntax language (since version 12.0), including modifications to existing commands and addition of new commands, are provided in the section Release History.

Core System

The Core system contains the core functionality plus a number of charting procedures. There are also numerous add-on modules that contain specialized functionality.

Getting Data

You can read in a variety of data formats, including data files saved in IBM® SPSS® Statistics format, SAS datasets, database tables from many database sources, Excel and other spreadsheets, and text data files with both simple and complex structures.

Get. Reads IBM SPSS Statistics data files.

Import. Reads portable data files created with the Export command.

Add Files. Combines multiple data files by adding cases.

Match Files. Combines multiple data files by adding variables.

Update. Replaces values in a primary file with updated values.

Get Translate. Reads spreadsheet and dBASE files.

Get Data. Reads Excel files, text data files, and database tables.

Get Data. Reads Excel files, text data files, and database tables.

Get Capture. Reads database tables.

Get SAS. Reads SAS dataset and SAS transport files.

Get Stata. Reads Stata data files.

Data List. Reads text data files.

Begin Data-End Data. Used with Data List to read inline text data.

File Type. Defines mixed, nested, and grouped data structures.

Record Type. Used with File Type to read complex text data files.

Input Program. Generates case data and/or reads complex data files.

End Case. Used with Input Program to define cases.

End File. Used with Input Program to indicate end of file.

Repeating Data. Used with Input Program to read input cases whose records contain repeating groups of data.

Reread. Used with Input Program to reread a record.

Keyed Data List. Reads data from nonsequential files.

Point. Used with Keyed Data to establish the location at which sequential access begins (or resumes) in a keyed file.

Dataset Name. Provides the ability to have multiple data sources open at the same time.

Dataset Activate. Makes the named dataset the active dataset.

Saving and Exporting Data

You can save data in numerous formats, including IBM SPSS Statistics data file, Excel spreadsheet, database table, delimited text, and fixed-format text.

Save. Saves the active dataset in IBM SPSS Statistics format.

Xsave. Saves data in IBM SPSS Statistics format without requiring a separate data pass.

Export. Saves data in portable format.

Write. Saves data as fixed-format text.

Save Translate. Saves data as tab-delimited text and comma-delimted (CSV) text.

Save Translate. Saves data in Excel and other spreadsheet formats and dBASE format.

Save Translate. Replaces or appends to existing database tables or creates new database tables.

Statistics Adapter

Repository Attributes. Sets attributes for an object in a

Repository Connect. Establishes a connection to a IBM SPSS Collaboration and Deployment Services Repository and logs in the user.

Repository Copy. Copies an arbitrary file from the local file system to a IBM SPSS Collaboration and Deployment Services Repository or copies a file from a IBM SPSS Collaboration and Deployment Services Repositoryto the local file system.

Data Definition

IBM SPSS Statistics data files can contain more than simply data values. The dictionary can contain a variety of metadata attributes, including measurement level, display format, descriptive variable and value labels, and special codes for missing values.

Apply Dictionary. Applies variable and file-based dictionary information from an external IBM SPSS Statistics data file.

Datafile Attribute. Creates user-defined attributes that can be saved with the data file.

Variable Attribute. Creates user-defined variable attributes that can be saved with variables in the data file.

Variable Labels. Assigns descriptive labels to variables.

Value Labels. Assigns descriptive labels to data values.

Add Value Labels. Assigns descriptive labels to data values.

Variable Level. Specifies the level of measurement (nominal, ordinal, or scale).

Missing Values. Specifies values to be treated as missing.

Rename. Changes variable names.

Formats. Changes variable print and write formats.

Print Formats. Changes variable print formats.

Write Formats. Changes variable write formats.

Variable Alignment. Specifies the alignment of data values in the Data Editor.

Variable Width. Specifies the column width for display of variables in the Data Editor.

Mrsets. Defines and saves multiple response set information.

Data Transformations

You can perform data transformations ranging from simple tasks, such as collapsing categories for analysis, to more advanced tasks, such as creating new variables based on complex equations and conditional statements.

Autorecode. Recodes the values of string and numeric variables to consecutive integers.

Compute. Creates new numeric variables or modifies the values of existing string or numeric variables.

Count. Counts occurrences of the same value across a list of variables.

Create. Produces new series as a function of existing series.

Date. Generates date identification variables.

Leave. Suppresses reinitialization and retains the current value of the specified variable or variables when the program reads the next case.

Numeric. Declares new numeric variables that can be referred to before they are assigned values.

Rank. Produces new variables containing ranks, normal scores, and Savage and related scores for numeric variables.

Recode. Changes, rearranges, or consolidates the values of an existing variable.

RMV. Replaces missing values with estimates computed by one of several methods.

Shift Values. Creates new variables that contain the values of existing variables from preceding or subsequent cases.

String. Declares new string variables.

Temporary. Signals the beginning of temporary transformations that are in effect only for the next procedure.

TMS Begin. Indicates the beginning of a block of transformations to be exported to a file in PMML format (with IBM SPSS Statistics extensions).

TMS End. Marks the end of a block of transformations to be exported as PMML.

TMS Import. Converts a PMML file containing ADP tranformations into command syntax.

TMS Merge. Merges a PMML file containing exported transformations with a PMML model file.

File Information

You can add descriptive information to a data file and display file and data attributes for the active dataset or any selected IBM SPSS Statistics data file.

Add Documents. Creates a block of text of any length in the active dataset.

Display. Displays information from the dictionary of the active dataset.

Compare Datasets. Compares the contents of the active dataset to another dataset in the current session or an external data file in IBM SPSS Statistics format.

Document. Creates a block of text of any length in the active dataset.

Drop Documents. Deletes all text added with Document or Add Documents.

Sysfile Info. Displays complete dictionary information for all variables in a IBM SPSS Statistics data file.

File Transformations

Data files are not always organized in the ideal form for your specific needs. You may want to combine data files, sort the data in a different order, select a subset of cases, or change the unit of analysis by grouping cases together. A wide range of file transformation capabilities is available.

Delete Variables. Deletes variables from the data file.

Sort Cases. Reorders the sequence of cases based on the values of one or more variables.

Weight. Case replication weights based on the value of a specified variable.

Filter. Excludes cases from analysis without deleting them from the file.

N of Cases. Deletes all but the first n cases in the data file.

Sample. Selects a random sample of cases from the data file, deleting unselected cases.

Select If. Selects cases based on logical conditions, deleting unselected cases.

Split File. Splits the data into separate analysis groups based on values of one or more split variables.

Use. Designates a range of observations for time series procedures.

Aggregate. Aggregates groups of cases or creates new variables containing aggregated values.

Casestovars. Restructures complex data that has multiple rows for a case.

Varstocases. Restructures complex data structures in which information about a variable is stored in more than one column.

Flip. Transposes rows (cases) and columns (variables).

Add Files. Combines multiple IBM SPSS Statistics data files or open datasets by adding cases.

Match Files. Combines multiple IBM SPSS Statistics data files or open datasets by adding variables.

Star Join. Combines multiple IBM SPSS Statistics data files or open datasets by adding variables.

Update. Replaces values in a primary file with updated values.

Programming Structures

As with other programming languages, the command syntax contains standard programming structures that can be used to do many things. These include the ability to perform actions only if some condition is true (if/then/else processing), repeat actions, create an array of elements, and use loop structures.

Break. Used with Loop and Do If-Else If to control looping that cannot be fully controlled with conditional clauses.

Do If-Else If. Conditionally executes one or more transformations based on logical expressions.

Do Repeat. Repeats the same transformations on a specified set of variables.

If. Conditionally executes a single transformation based on logical conditions.

Loop. Performs repeated transformations specified by the commands within the loop until they reach a specified cutoff.

Vector. Associates a vector name with a set of variables or defines a vector of new variables.

Programming Utilities

Define. Defines a program macro.

Echo. Displays a specified text string as text output.

Execute. Forces the data to be read and executes the transformations that precede it in the command sequence.

Host. Executes external commands at the operating system level.

Include. Includes commands from the specified file.

Insert. Includes commands from the specified file.

Script. Runs the specified script file.

General Utilities

Cache. Creates a copy of the data in temporary disk space for faster processing.

Clear Transformations. Discards all data transformation commands that have accumulated since the last procedure.

Erase. Deletes the specified file.

File Handle. Assigns a unique file handle to the specified file.

New File. Creates a blank, new active dataset.

Permissions. Changes the read/write permissions for the specified file.

Preserve. Stores current Set command specifications that can later be restored by the Restore command.

Print. Prints the values of the specified variables as text output.

Print Eject. Displays specified information at the top of a new page of the output.

Print Space. Displays blank lines in the output.

Restore. Restores Set specifications that were stored by Preserve.

Set. Customizes program default settings.

Show. Displays current settings, many of which are set by the Set command.

Subtitle. Inserts a subtitle on each page of output.

Title. Inserts a title on each page of output.

Matrix Operations

Matrix. Using matrix programs, you can write your own statistical routines in the compact language of matrix algebra.

Matrix Data. Reads raw matrix materials and converts them to a matrix data file that can be read by procedures that handle matrix materials.

Mconvert. Converts covariance matrix materials to correlation matrix materials or vice versa.

Output Management System

The Output Management System (OMS) provides the ability to automatically write selected categories of output to different output files in different formats, including IBM SPSS Statistics data file format, HTML, XML, and text.

OMS. Controls the routing and format of output. Output can be routed to external files in XML, HTML, text, and SAV (IBM SPSS Statistics data file) formats.

OMSEnd. Ends active OMS commands.

OMSInfo. Displays a table of all active OMS commands.

OMSLog. Creates a log of OMS activity.

Output Documents

These commands control Viewer windows and files.

Output Activate. Controls the routing of output to Viewer output documents.

Output Close. Closes the specified Viewer document.

Output Display. Displays a table of all open Viewer documents.

Output Export. Exports output to external files in various formats (e.g., Word, Excel, PDF, HTML, text).

Output Name. Assigns a name to the active Viewer document. The name is used to refer to the output document in subsequent Output commands.

Output New. Creates a new Viewer output document, which becomes the active output document.

Output Open. Opens a Viewer document, which becomes the active output document. You can use this command to append output to an existing output document.

Output Save. Saves the contents of an open output document to a file.

Charts

Caseplot. Casewise plots of sequence and time series variables.

GGraph. Bar charts, pie charts, line charts, scatterplots, custom charts.

Pplot. Probability plots of sequence and time series variables.

Spchart. Control charts, including X-Bar, r, s, individuals, moving range, and u.

Time Series

The Core system provides some basic time series functionality, including a number of time series chart types. Extensive time series analysis features are provided in Forecasting and Decision Trees. See the topic Add-On Modules for more information.

ACF. Displays and plots the sample autocorrelation function of one or more time series.

CCF. Displays and plots the cross-correlation functions of two or more time series.

PACF. Displays and plots the sample partial autocorrelation function of one or more time series.

Tsplot. Plot of one or more time series or sequence variables.

Fit. Displays a variety of descriptive statistics computed from the residual series for evaluating the goodness of fit of models.

Predict. Specifies the observations that mark the beginning and end of the forecast period.

Tset. Sets global parameters to be used by procedures that analyze time series and sequence variables.

Tshow. Displays a list of all of the current specifications on the Tset, Use, Predict, and Date commands.

Verify. Produces a report on the status of the most current Date, Use, and Predict specifications.