SPSS Short Course

Introduction to SPSS

Statistics Outreach Center

Short Course

Topics Covered:

  • The SPSS Environment
  • Inputting Data
  • Descriptive Statistics
  • Statistical Graphics
  • Advanced Data Techniques
  • Inferential Statistics, including:
  • Chi-square and T-tests
  • One-way ANOVA
  • Correlations
  • Regression
  • Exporting Output to Other Software
  • Some Further SPSS Resources

Introduction

This course is designed for beginning SPSS users, providing a basic introduction to SPSS through the topics listed above. The first sections introduce users to the SPSS for Windows environment and discuss how to create or import a dataset, transform variables, and calculate descriptive statistics. The remaining sections describe some commonly used inferential statistics, graphical display of output, and other related topics. During this tutorial, a sample dataset, Employee data.sav, is used for all examples. This example dataset can be downloaded from the webpage of short course at Statistical Outreach Center (

Getting Started

  • To open SPSSon computers which have it installed, go to the Start icon on your Windows computer. You should find SPSS under the Programs menu item.
  • If SPSS isn’t listed under programs, you may need to access it through the Virtual Desktop website (This site can be found at:
  • When using the Virtual Desktop to access SPSS, you can only open and save files from your University of Iowa personal drive (the H: drive) or from a data source (e.g., flash drive) you have connected prior to opening SPSS.
  • When using the Virtual Desktop, a dialog box may appear asking for read/write access. If you want to use and save files, you need to agree to give CITRIX full access.

When SPSS opens, it will present you with a window for opening a “New Dataset” or “another file”.

Section 1: The SPSS Environment

There are three main windows you will interact with when using SPSS: Data Editor, Output Viewer, and Syntax Editor. Each window produces its own type of SPSS file.

Window / File Suffix / Functions
Data Editor / .sav / View, define, enter, and edit data and run statistical analyses
Output Viewer / .spv / View the results of all statistical analyses and graphical displays of data.
Syntax Editor / .sps / View or write SPSS commands that can be saved or submitted to the SPSS processor. (This window is activated when you click on the Paste function.)

Section 2: Working with Data

Typically, your first step is to get your data into SPSS. There are two primary ways to accomplish this: enter the data directly into SPSS, or opening an existing dataset in SPSS.

2.1 Opening an Existing Dataset

An existing data file can be opened in the Data Editor. From the Data Editor window, choose the following menu options:

FileOpen > Data...

In the Open File dialog box, browse to the location of your dataset. If the file you want to open is an SPSS data file (.sav), you should see it listed. If the file you want to open is another file type, you will need to change the Files of Type selection to match the file type of the file you want to open. For example, to see an EXCEL file select “Excel (*.xls *.xlsx *.xlsm)” and you will see a list of the EXCEL files in the current folder.

Select the file from the list and click Open.

Notice that your data populated the data editor window and the output window opens and a line of syntax is written.

When the file you are opening is not an SPSS file, you may be asked for additional information before the file opens. For example, when SPSS opens an Excel file, a dialog box similar to the one below will appear to confirm your selection.

2.2 Opening Data from a Text File

Very large data files will often be saved as text (*.txt) documents (or sometimes a *.dat or a *.csv document). You can import these data sets into SPSS using the Text Import Wizard. From the menu in the Data Editor window, choose the following menu options:

File > Open > Data...

The Open File dialog box defaults to SPSS data file types. To open text files, change the Files of Type option to “Text Documents (*.txt)”. After selecting your text file, click Open. The Text Import Wizard will guide you through the process.

The 6 steps of the Text Import Wizard are:

1. Does your text file match a predefined format? Typically, the answer is No.

2. How are your variables arranged? Are variable names included on the top of your file?

3. The first case of data begins on which line number? How are your cases represented (one per line)? How many cases do you want to import?

4. Which delimiters appear between variables (Delimited format)? Where are the breakpoints between variables (Fixed-Width format)?

5. What are the variable names and formats?

6. Would you like to paste the syntax?

2.3 Entering Data Directly into SPSS

Assume you have a stack of completed surveys and you want to enter the data into SPSS.

In the data editor, there are two tabs in the lower left corner. Start by selecting Variable View. In Variable View you can create a list of the variables you want in your dataset and define the properties of those variables. When you name a variable and hit return, SPSS will assign default properties to the variable. Pay close attention to the Type and Measure properties as SPSS determines what values can be entered and what analysis can be conducted.

Most of the information in the Variable View window can be left alone. However, to get the most out of your data set (and to make things easier when running analyses), it is a good idea to fill out the Variable View “spreadsheet”. The following is a list of what each column of Variable View means.

  • Name: The name of your variable. It can be up to 64 characters long. Variable names cannot contain spaces or most symbols (punctuation, etc). Names must start with a letter.
  • Variable Type: You can format the way that the numbers look using the variable type option (click on the … button). Variable types include numeric, comma, dot, scientific notation, date, dollar, custom currency, and string. If the values will include text, make sure the variable type is “String” and has a width large enough to accommodate the values you want to enter.
  • Width: The length of the string, in characters, or the number of places before the decimal point in a number. It is typical to leave numeric variables at 8.
  • Decimals: The number of places after the decimal point to include.
  • Label: Use this option to write a description of what the variable means. Good for surveys, where a shortened version of the question can be used.
  • Values: If a variable is discrete (contains a finite number of possible values), then you can define the values using this option. Great for sex and yes/no variables, since it is easy to forget how you defined these variables numerically.
  • Missing: If a particular value (such as 999 or -999) is defined as a missing value, you can inform SPSS through this option.
  • Columns: Total length of the variable value to be displayed (in characters).
  • Align: How you would like the values to be aligned in the Data View.
  • Measure: What kind of variable do you have? Is it a “Nominal” variable (where values are unorderable labels), “Ordinal” (where the values are discrete, yet orderable), or “Scale” (where the values are continuous, or can be interpreted as continuous)? It is best to define the variable as scale even if it is only quasi-continuous so as not to limit your analysis options.

When you switch to the Data View (lower left corner) you can see that the variable names are now the column headings. To enter data for a particular subject, simply click on a cell and type in the value for that variable and subject.

As you type in your data, keep in mind each of the following:

  • Create a column for each variable of interest. In this example, we will use five columns, one for each of the following variables.
  • Create a separate line for each subject.
  • You may want to use a numerical code for variables like no/yes and male/female. It is typical to use 0 for no and 1 for yes. For sex, it is recommended that the name of the variable be male (or female) and then the responses can be 0 (no) and 1 (yes).

2.4 Saving data

To save the data that you entered, choose the following menu options in the Data Editor window:

FileSave As…

Browse to the file location where you want to save your data. Enter a name for the dataset. By default, SPSS will save the data as an SPSS data file (.sav) but you can the dataset in another format (e.g., Excel, ASCII, etc) by selecting the format from the list in the Save as type menu:

Notice that when you click Save, the output viewer opens and a line of SPSS syntax is written to the output window. This allows you to track what you have done in an SPSS session and you can save this file in order to have documentation of your session.

Section 3: Describing Your Data (Numerically)

Once you have data in SPSS, you can use SPSS to get to know the data. Most analyses that you will want to do can be found in the Analyze menu which is accessible from both the data and output windows.

3.1 Descriptive Statistics (Means, Standard Deviations, etc. for Continuous Variables)

Summary (or descriptive) statistics are available under the Descriptives option available from the Analyze and Descriptive Statistics menus:

Analyze > Descriptive Statistics > Descriptives...

Select the variables you are interested in and click the “arrow” button to move the variables over. If you don’t see a variable that you know is in your dataset, it may be because the variable is defined as string or nominal.

To view the available descriptive statistics, click on the button labeled Options. This will show the following dialog box:

After selecting the statistics you would like, click Continue. Output can be generated by clicking on the OK button in the Descriptives dialog box. The requested statistics will be displayed in the Output Viewer.

Descriptive Statistics
N / Minimum / Maximum / Mean / Std. Deviation
Current Salary / 474 / $15,750 / $135,000 / $34,419.57 / $17,075.661
Beginning Salary / 474 / $9,000 / $79,980 / $17,016.09 / $7,870.638
Valid N (listwise) / 474

3.2 Frequencies

The Frequencies procedure is found under the Analyze menu:

Analyze> Descriptive StatisticsFrequencies...

Click on the “Statistics…” button to see what descriptive statistics are available. Note that percentiles and descriptive statistics can be calculated in the Frequencies menu.

The example in the above dialog box would produce the following output:

Section 4: Describing Your Data Graphically

There are several ways to create graphs in SPSS: 1) As part of a statistical procedure; 2) Using the Legacy Dialogs; and 3) Using Chart Builder.

4.1 Graphs as part of a statistical procedure

Some popular graphs are included with the analyses they are most commonly associated with. For example, in the Frequencies procedure, you can select charts and choose from a bar chart, pie chart, or histogram.

Analyze> Descriptive StatisticsFrequencies...

Select charts to see what graphs are available. Graphs can be produced using frequencies or percentages.

4.2 Legacy Dialogs

A second way is to use the Legacy Dialogs under Graphs. This is described in more detail below. There are many types of graphs available through the Legacy Dialogs.

Scatter Plot

Prior to conducting a correlation analysis, it is advisable to plot the two variables to visually inspect the relationship between them. To produce scatter plots, select the following menu option:

Graphs > Legacy Dialogs> Scatter/Dot...

Select Simple Scatter and click define

Move the variable you want on the horizontal axis to the box marked x-axis and the variable you want on the vertical axis to the box marked y-axis.

The plot indicates that there is a positive, fairly linear relationship between education level and current salary. In order to test whether this apparent relationship is statistically significant, we could run a correlation.

Boxplot

A good way to visually inspect your variables is with a boxplot. To produce boxplots, select the following menu option:

Graphs > Legacy Dialogs> Boxplot...

Select Simple and either summaries for groups of cases or summaries of separate variables and click define. Choose Summaries for groups of cases if you want to break the data down by values of a grouping variable. Choose Summaries of separate variables if you want to compare the plots for different variables.

Suppose I want to look at how the distribution on salary varies as people get more education. Salary is the variable I want the boxplots to summarize so I move that to Variable. Educ is my grouping variable so I move that to Category Axis. I could break things down farther by putting a variable in for Rows or Columns, but let’s keep it simple for now.

4.3 Editing Graphs in Chart Builder

Chart builder is found under the Graphs menu:

Graphs > chart builder

Chart Builder allows you to build and preview a chart.

When you click on chart builder a message will remind you to check the measurement level of each of your variables before you begin. You can check the measurement level by clicking on the variable tab and looking at the “measure” column. Interval and ratio level data should be represented by “scale”. You can also establish that the variable is nominal or ordinal there. This is important because SPSS doesn’t allow some graphs and analyses to be done using nominal or ordinal level variables.

4.4 Gallery Tab

The gallery includes some different types of predefined graphs, organized by type.

Select Bar from the menu to access types of bar chart.

Drag the icon for the simple bar graph onto the large rectangular apace above the gallery. Note that right-clicking on the variables on this screen will allow you to change the measurement level of the data.

Drag the salary to the box representing the y axis and drag educ to the x axis.Click Element Properties.


The element properties window allows you to change many of the chart elements. Here you can change the statistic that will be displayed for the y variable. For example you could choose to display the medians for each variable rather than the mean. You can also add bars for confidence intervals, standard error or standard deviations.

There are also options for changing the x and y axes. The available options depend on whether the variable on that axis is categorized as scale, ordinal, or nominal data.

You can also delete any of the elements by selecting the element and clicking on the red cross.

4.5 Select Titles/Footnotes

Here you can add titles/footnotes to the graph. Select Title 1 and add a title to the graph. Click ok to create the graph.

4.6 Chart Editor

Once you have created a graph, you may decide you want to add an element. Double-clicking on the graph opens it in chart editor. You then have access to a variety of options for making changes. For example, by selecting the Elements menu example you can add interpolation lines connecting the individual data points in the graph. If you have completed a regression analysis you can add a line for the regression equation to the scatter plot of the data by selecting Fit Line at Total from the elements menu.

In the chart editor you can edit the graph in the following ways:

  1. Use chart templates
  2. Choose the display of data value labels
  3. Edit the chart text
  4. Change the chart colors

4.7 Pasting Graphs in Word

You can paste graphs into Word with all editing changes retained. Further edits to the graph are not possible once it is pasted in word.

Click the graph to be transferred. Select Edit > Copy. In Word, select Paste Specialfrom the Home tab. Then select Formatted Text (RTF) in the Paste Special dialog box and click ok.

Section 5: Data manipulation tools

5.1. Compute Variables

New variables can be created using the Compute option available from the menu in the Data Editor:

TransformCompute Variables...

To create a new variable, type its name in the box labeled Target Variable. The expression defining the variable being computed will appear in the box labeled Numeric Expression. The numeric expression can use SPSS functions, found in the along the right side of the dialog box or it can use arithmetic operators.

This new variable, salchange, will appear in the rightmost column of the working dataset.

When computing new variables always check the results carefully to see if you got the results you intended.

5.2. Recode Variables

It is often necessary to take an existing variable and recode it. This is similar to computing a new variable but often involves transformations that are more complicated than a single formula. For example, it may be advantageous to take a continuous variable and turn it into a categorical variable. Let’s say that we want to take the salary variable and define a new variable as follows: