SPSS Tutorials The SPSS Environment
This tutorial introduces the SPSS environment and the two ways of interacting with SPSS: drop-down menus and syntax.
The SPSS Environment
SPSS utilizes multiple types of windows, or screens, in its basic operations. Each window is associated with specific tasks and types of SPSS files. The windows include the Data Editor, Output Viewer, Syntax Editor, Pivot Table Editor, Chart Editor, and Text Output Editor. The following sections describe the basic purposes and functions of the three most common windows—the Data Editor, Output Viewer, and Syntax Editor—since these three windows are integral for most every action performed in the program. The other windows are relevant to more specific types of tasks.
The Data Editor window is the default window and opens when SPSS starts. This window displays the content of any open data files and provides drop-down menus that allow you to modify and analyze data. The data are displayed in a spreadsheet format where columns represent variables and rows represent cases. The spreadsheet format includes two tabs at the bottom labeled Data View and Variable View. The Data View tab displays the open data set: variables appear in columns, and cases appear in rows. The Variable View tab displays information about variables in the open data (but not the data themselves), such as variable names, types, and labels, etc. The tab that is currently displayed will be yellow in color.
When you perform any command in SPSS, the Output Viewer window opens automatically and displays a log of the actions taken and the associated output. Primarily, the Output Viewer is where the results of statistical analysis are shown, but any command invoked through the drop-down menus or syntax will be printed to the Output Viewer. This includes opening, closing, or saving a data file. If an Output Viewer window is not open when a command is run, a new Output Viewer window will automatically be created.
The Output Viewer window is divided into two sections, or frames. The left frame contains an outline of the content in the Output Viewer. This outline is especially useful when you have run many SPSS commands and need to locate a particular section of output easily. The right frame contains the actual output. Clicking on an item in the left frame will jump to that content in the right frame. Items that have been selected in the right frame are indicated by a red arrow and a box drawn around the content.
In the above example image, the Frequencies procedure was performed on a variable called Gender. In the left frame, the word "Frequencies” appears as a top-level item; beneath it, there are indented lines labeled "Title", "Notes", "Active Dataset", "Statistics", and "Gender." All of the indented items are associated with this Frequencies command. Also, notice the word "Log" that appears above Frequencies; that item shows the exact commands that the user requested to create that output (in the form of SPSS syntax). (Note that the Log will always contain the summary in the form of syntax, even if the output was generated through the drop-down menus.)
You can modify the contents in the Output Viewer by selecting items in the left or right frame and copying, pasting, or deleting them. To remove an item from the Output Viewer, click on its name in the left frame or click on the object itself in the right frame, then press the Delete key on your keyboard.
An Output Viewer window can be saved as a viewer file (*.spv) so that you can review it again without having to re-run the same commands in SPSS. To save an Output Viewer window, click File > Save As. Alternatively, you can export some or all of the contents in the Viewer window to a new document or image file by clicking File > Export. In general, you can export all content as a PDF (*.pdf), a PowerPoint file (*.ppt), an Excel file (*.xls or *.xlsx), a Word file (*.doc or *.docx), an HTML file (*.htm), or a text file (*.txt). Graphs can be saved as *.bmp, *.emf, *.eps, *.jpeg, *.png, or *.tif.
SPSS syntax is a programming language unique to SPSS that can be used as an alternative to the drop-down menus for data manipulation and statistical analyses. The Syntax Editor window is where users can write, debug, and execute SPSS syntax. To open a new Syntax Editor window, click File > New > Syntax.
Syntax can be saved as a *.sps file by clicking File > Save.
An active window is a window that is currently selected and on which any commands will be run. If you have multiple windows of the same type open, it is important to know which of these is the active window because SPSS may direct specific information to the active window. For example, if you have more than one Output Viewer window open, SPSS will display the contents of any command you run in the active Output Viewer window. Thus, if you want output to display in a specific output file, you will want to make sure that file is the active window. You may have multiple windows open during a session (e.g. multiple Output Viewer windows), but only the window that is currently selected is considered active. The active window can be identified by the small + sign in the upper left hand corner of the window.
Example of active Data Editor window.
Example of active Output Viewer window.
SPSS Toolbar Shortcuts
By default, the Data View window has the following shortcuts for common tasks.
|Open data document||Open a datafile. Equivalent to File > Open > Data.|
|Save this document||Save the active dataset. Equivalent to File > Save or Ctrl + S.|
|Print the contents of the active data view window. Not recommended. Equivalent to File > Print.|
|Recall recently used dialogs||Shows the list of most recently used dialog windows. Use when you need to re-run an analysis.|
|Undo a user action||Equivalent to Edit > Undo (in the drop-down menus) or Ctrl + Z.|
|Redo a user action||Equivalent to Edit > Redo (in the drop-down menus) or Ctrl + Y.|
|Go to case||Jump to a specific case (row) in the active dataset. Equivalent to Edit > Go to Case.|
|Go to variable||Jump to a specific variable (column) in the active dataset. Equivalent to Edit > Go to Variable.|
|Variables||View the variable name, labels, type, measurement level, missing value codes, and value labels for all variables in the active window. Equivalent to Utilities > Variables.|
|Run descriptive statistics||Run descriptive statistics (using the Frequencies procedure) on the selected variable. The statistics shown are determined by the variable measurement level setting. Nominal and ordinal variables are summarized with a frequency table; scale variables are summarized using mean, median, standard deviation, range, minimum, and maximum. Only activates when a cell or column in the Data View window is selected. Equivalent to Analyze > Descriptive Statistics > Frequencies.|
|Find||Search for a value or observation in the dataset, or search and replace a value or observation in the dataset. Only activates when a cell in the Data View window is selected. Equivalent to Edit > Find and Edit > Replace, or Ctrl + F and Ctrl + H, respectively.|
|Insert cases||Insert a case between two existing cases. Equivalent to Edit > Insert Cases.|
|Insert variable||Insert a new variable between two existing variables. By default, new variables created this way are scale numeric variables. Equivalent to Edit > Insert Variable.|
|Split file||Stratify your analyses based on a categorical variable. For example, if the variable Gender is selected in Split File, running descriptive statistics on any other variables will produce descriptives for males and females separately. Equivalent to Data > Split File.|
|Weight cases||Set a weighting variable. Equivalent to Data > Weight Cases.|
|Select cases||Extract a set of cases to a new datafile based on some criteria, or apply a filter variable. Equivalent to Data > Select Cases.|
|Value labels||Toggle whether the raw data or the value label is displayed in the Data View window. Equivalent to View > Value Labels.|
|Use variable sets||Select or unselect sets of variables to show in the active window. Multiple sets can be selected at a time. Equivalent to Utilities > Use Variable Sets. Note that you must first define a variable set (Utilities > Define Variable Sets) in order for this to be useful.|
|Show all variables||Shows all variables in the active dataset. Only activates if Use Variable Sets has been used. Equivalent to Utilities > Show All Variables.|
|Spell check||Searches the contents of the dataset for misspellings. Only activates when data is entered into the Data View window or a data file is opened. Equivalent to Utilities > Spelling.|
Executing Commands in SPSS
SPSS offers two basic ways of working with your data: drop-down menus and syntax commands.
Drop-down menus: Users who are new to SPSS typically learn the software by using drop-down menus. These are the menus that you see across the toolbar at the top of the screen--e.g., File, Edit, View, Data, etc. These menus provide the options you need for performing specific actions on your data. Clicking on any one of the menus will produce a list of menu items. You may then select a specific menu item from the list to perform specific actions.
Syntax Commands: Advanced users can interact with SPSS by writing their own syntax. Syntax is a command-driven language that tells SPSS what actions to perform on the data. Using syntax commands (rather than drop-down menus) is preferable for several reasons:
- Syntax allows users to write commands that are not available via drop-down menus.
- Syntax provides a useful log of what steps you have taken while working with your data.
- Syntax allows you to easily edit your commands, in any order, rather than having to re-select each drop-down command if you decide to change some part of your analysis.
- Syntax allows you to consistently reproduce your commands, which is important for validating your methods.
Overall, syntax offers more flexibility, a clearer record, and greater ease in making changes and re-running commands. It does take some practice to learn to write the basic command language, but once you learn the language the benefits of working with data in this way will become very clear.
To use syntax, click File > New > Syntax. This opens a new Syntax Editor window where you can write and execute syntax commands.