Skip to Main Content
It looks like you're using Internet Explorer 11 or older. This website works best with modern browsers such as the latest versions of Chrome, Firefox, Safari, and Edge. If you continue with this browser, you may see unexpected results.

Analyze Data: SPSS

Getting Started: Data Entry

Data Editor

The data editor provides a spreadsheet like method for creating and editing data files. It automatically opens when you start a session. Within the data editor, there are two views data and variable. 

Data View

Data view displays the actual data values or defined values labels

  • Columns represent the variables.
  • Rows represent the cases/observations.

To switch to the Data View click on the tab at the bottom left.

Variable View 

Variable view displays variable definition, information, including defined variable and value labels, data type (i.e. string, data and numeric), measurement level (nominal, ordinal or scale), and user‐defined missing values.

To switch to the Variable View click on the tab at the bottom left.

Getting Started: Data Entry

You can enter data directly into the Data Editor in the Data view. You can enter data in any order.

  1. In the data view, select a cell.
  2. Enter the data value. The value is displayed in the cell editor at the top of the Data Editor.
  3. Click Enter button or select another cell to record the value.

Getting Started: Importing Data

In addition to files saved in SPSS format, you can open the spreadsheet (Excel), Database (Access, dBASE), tab‐delimited files and other types of ASCII text files without converting the files to an intermediate format or enter data definition information.

Opening an SPSS file (*.sav)

  1. Click on File. Select Open. Select Data.
  2. To view all files, in the Files of Type drop-down menu select the All Files (*.*) option.
  3. In the ‘Open File’ dialog box, select the file you want to open.
  4. Click Open.

Opening an Excel file (*.xls)

  1. Click on File. Select Open. Select Data.
  2. To view all files, in the Files of Type drop-down menu select the Select type of file as Excel *.xls *.xlsx, *.xlsm option.
  3. In the ‘Open File’ dialog box, select the file you want to open.
  4. Click Open.
  5. The following dialog box appears

Opening a Text file (*.txt, *.dat, or *.csv)

  1. Click on Files>Open>Data.
  2. To view all files, in the Files of Type drop-down menu select the All Files (*.*) option.
  3. In the ‘Open File’ dialog box, select the file you want to open.
  4. Click Open.
  5. The Text Import Wizard appears.

Using the Text Import Wizard

  1. If the data follows a predefined format (previously saved from the text wizard) click Yes and browse for the file defining the format.If the data is not in a predefined format click Next.
  2. The Text Import Wizard needs to determine where the data for one variable ends and the data value for the next variable begins. If the first row of the data file contains descriptive labels for each variable, you can use these labels as variable names.
  3. If the first row of the data file contains descriptive labels for each variable then select the row number the data begins. You will need to specify how cases are represented in the data file. Cases can span over one or more lines. SPSS can import the full or partial dataset.
  4. Characters or symbols used to separate variable/columns. Text strings can be enclosed by either single, double or other symbols.
  5. By clicking on the variable name in the Data preview window, you can change the variable name and data format.
  6. You can save your specifications in a file for use when importing similar text data files. You can also paste the syntax generated by the Text wizard into a syntax window

Working with Data: Compute Variables

Compute Variable computes values based on numeric transformations of other variables. For example, Compute Variable can be used to :

  • calculate BMI using height and weight
  • convert weight from pounds to kilograms
  • conditionally generate a computation based on a condition

For this example, we want to find the hourly wage of each individual. To find this we would divide the income variable by hours variable.

How to compute variable:

  1. Click on Transform. Select Compute Variable.  
  2. In the text box labeled ‘Target Variable’, type in a variable name (hourly in this case) where the calculation result is to appear. It can be an existing or new variable name. If you choose to type in an existing variable, the values of this variable will be overwritten.
  3. To build an expression (calculation), either paste components or type directly into the ‘Numeric Expression’ field (income/hours in this case). 
  4. If you wish the calculation in question is only applied to a certain subset of the data, the If function is invoked. For example, you may want to increase the salary for female by $100. To do this click on the ‘If’ button located at the bottom of the Compute Variable window shown above. 

Working with Data: Record Into Same Variable

  • You can modify data values by recoding them. This is particularly useful for collapsing or combining categories.
  • You can recode values within existing variables or you can create new variables based on the recoded values of existing variables.
  • Recode into Same Variables reassigns the values of existing variables or collapses ranges of existing values into new values.
    • For example, you could collapse salaries into salary range categories. You can recode numeric and string variables. If you select multiple variables, they must all be the same type. You cannot recode numeric and string variables together. 

How Recode Values Of A Variable

  1. Click on Transform. Select Recode. Select Into Same Variables.
  2. Select the variables you want to recode. If you select multiple variables, they must be the same type (numeric or string).
  3. Click on Old and New Values and specify how to recode values. 

Working with Data: Recode Into Different Variables

  • Recode into Different Variables reassigns the values of existing variables or collapses ranges of existing values for a new variable.
  • For example, you could collapse salaries into a new variable containing salary range categories.  
  • You can recode numeric and string variables  
  • You can recode numeric variables into string variables and vice versa.  If you select multiple variables, they must all be the same type.
  • You cannot recode numeric and string variables together. 

For this example, we want to code a variable to categorize level of education (educ_cat). If the participant has <= 8 years of education then educ_cat = 1 (only elementary), if years of education < 12 years then educ_cat = 2 (some high school) , if years of education = 12 then educ_cat = 3 (high school grad), if years of education > 12 then (college/university).

How to Recode Into Different Variables

  1. Click on Transform. Select Recode. Select Into Different Variables.
  2. Select the variables you want to recode. If you select multiple variables, they must be the same type (numeric or string).
  3. Enter an output (new) variable name for each new variable and click Change. 
  4. Click on Old and New Values and specify how to recode values.

Working with Data: Split the File

This is a very well used feature in SPSS. It allows you to temporarily split your data into different groups based on the categories of a particular variable.

How to Split a File

  1. Click on Data. Select Split File. 
  2. The program can split the data either by Compare groups or Organize output by groups.
  3. In the Groups Based on box, place the splitting variable. This variable should be nominal and ordinal categorical variable. 

Exploring Data: Descriptives

The Descriptives procedure is used to find the measures of central tendency (mean, median, mode) and measures of dispersion (range, standard deviation, variance, minimum and maximum) and measures of kurtosis and skewness. This procedure is best suited to describe continuous variables.

How to Run Descriptives

  1. Click on Analyze. Select Descriptive Statistics. Select Descriptives. 
  2. The standardized values can be saved as variables to save z-scores as new variables

Exploring Data: Frequencies

The Frequencies procedure is used generate statistics and graph summaries for categorical variables.

How to Run Frequencies

  1. Click on Analyze. Select Descriptive Statistics. Select Frequencies. 
  2. Select one or more categorical or quantitative variables. Optionally, you can:  
  • Click Statistics to select which descriptive statistics to generate the output. Most of these statistics are appropriate for continuous data.   
  • Click Charts for bar charts, pie charts, and histograms.  
  • Click Format for the order in which results are displayed.

Exploring Data: Explore

The Explore procedure is used to examine whether a variable is normally distributed with statistics (Shapiro-Wilk and Kolmogorov-Smirnov) and plots (Q-Q Plot, Stem and Leaf Plot and Box Plot).

How to Run Explore

  1. Click on Analyze. Select Descriptive Statistics. Select Explore. 
  2. To assess whether a variable is normally distributed, click Plots button.
  3. Check off the Normality plots with tests option.

Exploring Data: Crosstabs

A crosstabulation table is also known as a crosstabs or contingency table. It is used to show the relationship between two or more categorical variables.

How to Run Crosstabs

  1. Click on Analyze. Select Descriptive Statistics. Select Crosstabs. 
  2. Place one variable is the home owned by the household? [owned] in the Row box and another variable is the home on mortgage [mortgage] in the Column box.
  3. Click the Cells button. The Statistics dialog box allows you to configure the resulting table with a combination of counts, percentages, and residuals.

Analyzing Data: Chi-Square Test of Independence

The Chi-Square is used to test whether the relationship between two cross-tabulated variables is significant. The Chi-square is based on two assumptions.

  • Firstly, the individual observation must be independent of each other.
  • Secondly, the expected frequencies should be greater that 5. In a larger table, not more than 20% of the variables can have expected frequencies less than 5. 

For the Chi-Square, the null hypothesis that the row variable is unrelated (that is, only randomly related) to the column variable. The alternative hypothesis is not rejected when the variables have an associated relationship

How to run a Chi-square for a crosstabs

  1. Click on Analyze. Select Descriptive Statistics. Select Crosstabs.
  2. Then click on the Statistics button.
  3. Check off the Chi-square checkbox.

Analyzing Data: One Sample t-test

A one sample t-test procedure tests whether the mean of a single variable differs from a specified constant.

Research Question

We are interested in determining whether the average age of stay at home mothers is the national average of 37 years of age.

How to run a one samples t-test

  1. Click on the Analyze. Select Compare Means. Select One Sample t-test. 
  2. The test variable is the age of the wife [age]. The test value for this case is 37.

Analyzing Data: Independent Samples t-test

The independent samples t-test. It is also referred to as unpaired or unrelated samples t-test.

  • It allows for us to compare the means observed for one variable for two independent samples. When running this parametric test, SPSS generates descriptive statistics for each group, a Levene’s test for equality of variance.
  • It also reports the equal and unequal variance t-values and the 95% confidence interval for difference in means

Research Question

We are interested if there is a difference between the number of hours the wife worked in households with and without a mortgage.

How to run an independent samples t-test

  1. Click on Analyze. Select Compare Means. Select Independent Samples T-test. The variables we are testing is the wife working hours per year [hours] and is the home on mortgage [mortgage].
  2. Clicking the Define Groups allows us to indicate which groups are to be compared. This can be done by actually entering in specific values for each group or specifying a cut-off point (cut point).

Analyzing the Data: Paired Samples t-test

The paired samples t-test is also referred to as the dependent or related samples t-test. It is useful for testing if a significant difference occurs between the means of two variables that represent the same group at different times (before or after) or related groups (husband or wife).

  • For example in medical research, a paired t-test is used to compare the means on a measure before (pre) and after (post) a treatment. Looking at market research, test could be used to compare the rating an individual gives a product they usually purchase and competing product on some characteristic.

Research Question

We are interested in determining whether there is a difference between the age respondents first smoked and the age at which they began smoking cigarettes daily

How to run a paired samples t-test

  1. Click on Analyze. Select Compare Means. Select Paired Samples T-test. 
  2. The pairs of variables we have chosen for the analysis is the number of cigarettes first smoked when started smoking (ps_q30) and the number of cigarettes smoked when began smoking on a daily basis (ps_q40). Select these variables and move them to the Paired Variables window. Then click on the OK button to the right.

Analyzing Data: One-way ANOVA

This procedure compares the means from several samples and tests whether they are all the same or whether one or more of them are significantly different. This is an extension of the t-test for datasets containing more than two samples.

Research Question

We are interested in determining whether there is a difference between age of 

How to run a one-way ANOVA​

  1. Click on Analyze. Select Compare Means. Select One-Way ANOVA. The dependent variable is the age of the wife [age]. For this example, the occupation of the husband [Occupation_husband] is the factor which is the independent variable defining groups of cases.
  2. Click on the Post Hoc button to test for pairwise multiple comparisons between means. Check the Tukey checkbox and select Continue.
  3. Click on the Options Button. Check off Homogeneity of Variance test and then click on the Continue button.

Suggest an edit to this guide

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.