Text files are another common source of data. Many spreadsheet programs and databases can save their contents in one of many text file formats. Comma or tab delimited files refer to rows of data that use commas or tabs to indicate each variable. In this example, the data are tab delimited.

From the menus choose:

File
Read Text Data

Choose Text (*.txt) from the Files of Type listbox.

Select demo.txt and click Open to read the selected file.

The Text Import Wizard guides you through the process of defining how the specified text file should be interpreted.

In Step 1, you can choose a predefined format or create a new format in the wizard. Select No to indicate that a new format should be created.

Click Next to continue.

As stated earlier, this file uses tab delimited formatting. Also, the variable names are defined on the top line of this file.

Select Delimited to indicate that the data uses a delimited formatting structure.

Select Yes to incicate that variable names should be read from the top of the file.

Click Next to continue.

Type 2 in the top section of this dialog to indicate that the first row of data starts on the second line of the text file.

Keep the default values for the remainder of this dialog and click Next to continue.

The Data Preview provides you with a quick way to ensure your data are being properly read by SPSS.

Select Tab and deselect the other options.

Click Next to continue.

Because the variable names may have been truncated to fit SPSS formatting requirements, this dialog gives you the opportunity to edit any undesireable names.

Data types can be defined here as well. For example, it's safe to assume that the income variable is meant to contain a certain dollar amount.

To change a data type...

Under Data Preview, select the variable you want to change, which is Income in this case.

Select Dollar from the Data Format list.

Click Next to continue.

Leave the default selections on this dialog and click Finish to import the data.