SPSS Command Types


SPSS commands come in three basic types: procedures, transformations and other commands. Understanding this distinction will allow you to get things done in SPSS faster and more efficiently.

SPSS Command Types Diagram

SPSS Command Types

SPSS Transformations

As shown in the figure, the first question is when a command is executed. Some SPSS commands are not carried out immediately when you run them. Such commands are referred to as transformations.
Most transformations create or “transform” data values. Typical examples are COMPUTE and IF. As a rule of thumb, only transformations can be used with LOOP, DO IF and DO REPEAT. For a more detailed discussion, see SPSS Transformation Commands.

SPSS Procedures

For commands that are executed immediately, the second question is whether they read the data. In SPSS, “reading the data” refers to the process of SPSS going through all cases (from top to bottom) in the data. This is explained and illustrated under data pass.
All commands that read the data are referred to as procedures in SPSS. Procedures do two basic things: report on data values (DESCRIPTIVES, FREQUENCIES) or create/tranform data values (AGGREGATE, RANK).
A reason for distinguishing procedures from other commands is that they do more than just their core functions. For instance, they also cause transformations to be executed and some other things. Second, procedures may require a lot of time when run on large datasets. For a more detailed discussion, see SPSS Procedures.

Other SPSS Commands

SPSS Command Types

As shown in the figure, 5 groups of SPSS commands that are neither procedures nor transformations can be distinguished. These commands perform all sorts of tasks except report on data values or create/edit data values. We'll briefly discuss these 5 groups in the remainder of this tutorial.

SPSS Dictionary Commands

SPSS data files consist of two main components. First, there's data values as can be seen in data view. Second, there's dictionary information, part of which can be seen in variable view. SPSS’ dictionary contains mostly information describing data files and their variables and values.
Some dictionary information being incorrect or absent (especially missing values, variable labels and value labels) can cause corrupted data and erroneous research conclusions. It's therefore recommended that you carefully manage your data’s dictionary. The table below lists some commands for doing so. These commands can't be pasted from the menu but, fortunately, they're utterly simple.
Do not edit dictionary information manually under variable view. Because you can't keep track of such modifications (let alone replicate or correct them), you may have to do things all over if anything goes wrong.

Overview Main SPSS Dictionary Commands

Command NameBasic Function
ADD VALUE LABELSAdd or edit value labels.
MISSING VALUESSpecify missing values for one or many variables.
VALUE LABELSErase all value labels from one or more variables and/or specify new ones. For editing value labels, ADD VALUE LABELS is usually a better option.
RENAME VARIABLESChange variable names.
VARIABLE LABELSAdd or edit description of variables.
FORMATSSet formats for (mostly) numeric variables.
VARIABLE LEVELSets measurement levels for variables.
VARIABLE WIDTHSet display width (columns in variable view) for variable(s).
DELETE VARIABLESPermanently delete one or more variables.
STRINGCreate new string variable before setting its values with COMPUTE, IF or other command.
DOCUMENTA DOCUMENT is a data file description that is saved as part of the dictionary.
APPLY DICTIONARYCopy dictionary properties between files or variables.
DISPLAYDisplay parts of dictionary. Use SHOW for displaying settings.
SYSFILE INFODisplay dictionary information from external SPSS data file.

SPSS Windows Commands

Starting from SPSS version 14, you can have multiple Data Editor windows open simultaneously. These are referred to as datasets. For controlling these windows, use DATASET commands, some of which are listed in the table below.
From SPSS version 15, multiple output viewer windows can be used at once as well. These can be controlled by the OUTPUT commands in the table below.
Finally, you can also use multiple Syntax Editor windows simultaneously. Oddly, commands such as SYNTAX SAVE are as yet non existent in SPSS.
Note that OUTPUT MODIFY, introduced in SPSS version 22, is entirely different from the other OUTPUT commands: it does not control output windows but modifies items (mostly tables) in the active output window.

Overview Main SPSS Windows Commands

Command NameBasic Function
DATASET NAMEAssign name to dataset by which it can be addressed. Allows working on multiple datasets simultaneously.
DATASET ACTIVATEChoose which dataset is addressed by subsequent commands.
DATASET CLOSEClose dataset (without saving).
OUTPUT NAMEAssign name to output window by which it can be addressed. Allows using multiple output windows simultaneously.
OUTPUT ACTIVATEChoose output window to which subsequent output should be appended.
OUTPUT CLOSEClose output window (without saving).

SPSS Sytem Settings

SPSS system settings control a myriad of (sometimes technical) SPSS settings. These settings hold for all open SPSS windows.

Overview Main SPSS System Settings

Command NameBasic Function
SETEdit one or more settings except CD. Use SHOW for displaying settings.
SHOWShow one or more settings. Use SET for editing settings. Use DISPLAY for showing dictionary information.
CDSet default directory. Affects all commands (including GET, SAVE, INSERT and SET CTEMPLATE) except SET TLOOK.
PRESERVERemember current settings. Enables to RESTORE them later.

SPSS Data Settings

Some settings are applied only to the active dataset, which distinguishes them from SPSS system settings. They are listed in the table below.

Overview SPSS Data Settings

Command NameBasic Function
FILTERExclude selection of cases from procedures.
SPLIT FILEHave procedures process groups of cases separately.
WEIGHTAssign weights to cases.

Other SPSS Commands

Finally, some SPSS commands don't fit into any of the aforementioned groups. These include some very useful ones such as INSERT, VECTOR and OMS. The table below lists some of them.

Overview Main Other SPSS Commands

Command NameBasic Function
INSERTRun external syntax file. Successor of (now deprecated) INCLUDE.
INCLUDERun external syntax file. Deprecated as predecessor of INSERT.
VECTORAllow variables to be addressed by index. Mainly used with LOOP.
OMSStart monitoring, capturing or suppressing selected output.
OMSENDStop monitoring/capturing/suppressing selected output and show/save captured output if any.
DEFINE-!ENDDEFINEDefine macro. Mostly deprecated since Python was introduced in SPSS version 14.
SCRIPTDeprecated since Python was introduced in SPSS version 14.
PERMISSIONSSet file permissions (read-only).
ERASEDelete one or more external files. Use carefully.
OUTPUT MODIFYModifies output items such as tables.

Tell us what you think!

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