Importing Data into SPSS
If you already have data that are in an SPSS file format (file extension “.sav”), you can simply open that file to begin working with your data in SPSS. However, if you have data stored in other types of files, such as an Excel spreadsheet or a text file, you will need to instruct SPSS how to read the file and then save it in the SPSS file format (“.sav”). Below, we will cover how to import data from two common types of files: Excel files and text files.
Importing Data from an Excel File
To import data from an Excel spreadsheet into SPSS, first make sure your Excel spreadsheet is formatted according to these criteria:
- The spreadsheet should have a single row of variable names across the top of the spreadsheet in the first row.
- Variable names should include ordinary letters, numbers, and underscores (e.g., Gender, Grad_Date, Test_1) and not include special characters (e.g., “Graduation Date” would not be a valid variable name because it contains a space).
- The data should begin in the first column, second row (beneath the variable names row) of the spreadsheet.
- Anything that is not part of the data itself (e.g., extra text, labels, graphs, Pivot Tables) should be removed.
- Missing values for string or numeric variables have blank (empty) cells, or an appropriate predetermined missing value code (such as -999).
Once the data in your Excel file is formatted properly it can be imported into SPSS by following these steps:
- Click File > Open > Data. The Open Data window will appear.
2. In the Files of typelist select Excel (*.xls, *.xlsx, *.xlsm) to specify that your data are in an Excel file. If you do not specify the type of file that you wish to open, your file will not appear in the list of available files. Locate and click on your file. The file name will appear in the File name Click Open.
3. If you are using SPSS Version 25, the Read Excel File window will appear.
- In the Worksheet dropdown menu, select the sheet from your Excel workbook that contains your data. (If you have not assigned names to the sheets in your Excel workbook, the labels you see here will usually be Sheet1, Sheet2, Sheet3, etc.) You can only import one sheet from your Excel file at a time
- If your variable names are in the first row of data, select the Read variable names from the first row of data check box.
- The options Remove leading spaces from string values and Remove trailing spaces from string valuesonly affect variables that are imported as strings. The former will remove any whitespace characters that appear at the start of the string, and the latter will remove any whitespace characters at the end of the string. This is optional, but is often convenient, since leading and trailing spaces can appear invisible to the user, but cause SPSS to think that otherwise identical strings are distinct.
- You may also specify the range of rows/columns to import if you wish. It is suggested to keep the default value unless you have a reason for altering it.
- Click OK when you are finished.
4. If you are using SPSS version 24 or earlier, you will instead see the Opening Excel Data Source window:
The meaning of Read variable names from the first row of data checkbox, the Worksheet dropdown, and the Range box are the same as above. The Maximum width for string columns option determines how wide a string variable should be; it is suggested to keep the default value unless you have a reason for altering it.
Now the data will appear in SPSS. Here is an example of how sample data appear in SPSS once the data have been imported: