Statistics in SPSS

After you have installed the latest version of SPSS on your computer, you are ready to import your first data set and run some basic analyses. This page provides a brief guide on how to open SPSS, load a data set in, and run basic descriptive statistics.

We have also included some more advanced topics and resources at the end of the guide. If you need help downloading and installing the latest version of SPSS, make sure check out our Installing Statistical Software Programs page.

There are two ways to import data in SPSS. The first method requires you to simply click on “File”, then go to “Import” and select the type of data set your would like to import. In most cases, you will be using Excel or .csv files, which are the first and second options in the menu. After you select your file, it will be automatically loaded into SPSS to allow analyses.

You can also use the code below to import a Comma Separated Values (.csv) file or Excel file.

* Code to import a .csv or Excel data set in SPSS

get data  /type=txt
  var1 = AUTO
var2 = AUTO


* Activate dataset to front window

dataset name DataSet1 window=front.

* Code to import an Excel data (.xlsx) data set in SPSS 

  /SHEET=name 'Name-of-Sheet' 

get data 
/sheet=name 'Sheetname'

* Activate dataset to front window

dataset name DataSet1 window=front.

To gain a basic understanding of your data, the next step is to run descriptive statistics in SPSS using the code below.

* Code to calculate descriptive statistics and frequencies
* in SPSS

* IMPORTANT: Unlike R, Python and Stata, SPSS requires 
* line(s) for each command to be ended with a "."

frequencies x y z
/statistics median mean quartiles stddev min max.

* You can also run descriptives with this command
* However, it does not allow for computing the median

descriptives x y z
/statistics mean quartiles stddev min max kurtosis skew stderr.

* Next, correlations will show you if any variables
* are significantly associated each other and how
* strong that association is

/variables=x y z
/print=twotail nosig

* If you do see any significant (* starred)
* correlations, you can visualize the relationship
* with a scatterplot in SPSS

/scatter x with y
/subtitle "Scatterplot of X and Y (r = - 0.2; n = 128).

There are numerous other advanced topics in data science and statistics, and we at Data Science for Anyone are hard at work on creating new expert guides for R, Python, Stata and SPSS. If you want to learn about specific commands in SPSS or have questions about how to run commands in SPSS with the point-and-click or syntax-based interfaces, we highly recommend the helpful search engine and resources on this site.

Don’t forget to check back frequently for updates to this page with more SPSS commands and hot-to guides. In the meantime, we also love the educational resources on data science and statistics hosted by the Institute for Digital Research & Education Statistical Consulting (IDRE) at UCLA!