SPSS Import Text File

This SPSS tutorial explains how to import text file into SPSS.

SPSS Import Text File

Navigate to File > Open > Data

spss import text 01


Select Text in Files of Type, and then select the target text file

spss import text 02


Step 1

spss import text 03

Does your text file match a predefined format?

Leave the option default as No if this is the first time you import this file.

Select Yes if you have previously saved the format in your last import.


Step 2

spss import text 04

How are your variables arranged?

Whether you want to separate the data by characters like comma, colon, tab, or anything you specify (which will be defined later).

Fixed width means to separate data by character length.

In our example, we want to import txt file, which should be delimited by Tab, therefore we leave this option default as Delimited

Are variable names included at the top of your file?

Whether the first row of your data is the header. Since my text file has headers, I choose Yes


Step 3

spss import text 05

The first case of data begins on which line number?

Since I said the first row is header in the last step, the data begins in line 2.

How are your cases represented?

If each row of data represents data set of each person (a case), then you should choose Each line represents a case

If you have combined different persons (cases) in one data row, SPSS can help you move the data down the next row if you choose A specific number of variables represents a case

For example, if you data looks like this

Name  Address   Gender   Name  Address   Gender   
Peter    HK      M       Mary    US        F

When you tell SPSS 3 variables represent a case, then SPSS will help you move the data down

Name  Address   Gender 
Peter    HK       M
Mary     US       F


Step 4

spss import text 06

Which delimiters appear between variables?

We want to separate the text by Tab, because txt file is Tab delimited

What is the text qualifier?

This option is to prevent data from being mistakenly delimited. Some data such as CSV file are delimited by comma,  but the data itself may contain comma and you don’t want to delimit them with comma. In that case, you may enclose the data with another symbol to indicate that is one data.

For example, if your data is enclosed with double quote

 "May, John, Mary"    "Peter"    "Zoe"

As you select Double quote in this option, SPSS will split the data as below

May, John, Mary    Peter     Zoe


Step 5

spss import text 08

Variable name

SPSS has specific rules on the naming (e.g. no space is allowed), it will suggest you an acceptable Variable name

Data Format

SPSS automatically guesses the data type for you and you can verify if the guess is correct, correct it if wrong


Step 6

spss import text 09

Would you like to save this file format for future use?

This is for use in Step 1

Would you like to paste the syntax?

Choosing Yes will generate the code in Syntax Editor for all the options you selected. The import action will not execute until you click on the Run button in the Syntax Editor.

Cache data locally

This option is only useful when the SPSS file is located in network drive. Cache data locally will improve the performance especially for large database.


Txt file successfully imported

spss import text 10

Outbound References



Leave a Reply

Your email address will not be published.