Data Stored in a Text File
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.

step From the menus choose:

File
 Read Text Data

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

step 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.

step 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.

step 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.

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

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

step Click Next to continue.

step 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.

step 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.

step Select Tab and deselect the other options.

step 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...

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

step Select Dollar from the Data Format list.

step Click Next to continue.

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