Preparedness for Chemical, Biological, Radiological, Nuclear, and Explosive Events: Administrator's Guide (continued)

2.3.3.  Downloading and Importing Data into SPSS

SPSS is designed to manage data from many formats, including Lotus 1-2-3, MS Excel, dBASE, SAS, and ASCII text files. Data that is in an ASCII text file format (.txt) can easily be transferred into SPSS for analysis by using the Text Wizard function in SPSS. The following instructions for importing data use a text file format for illustration; however, the instructions are similar for data stored in other formats.

Getting Ready. To download the data for ultimate import into SPSS, click on the "Download Data" link on the left side of the Administration Web site. This will provide a .txt file, which should be saved to your hard drive.

Survey Response Summary Report: Columns for organization name, State, and point of contact (P.O.C.) E-mail address. Site menu with home, change password, download data, and log out is on the left. Download Data is circled.

Next, open the SPSS program in Windows. From the menu choose "File," then "Read Text Data." The computer will prompt you to open the file you wish to import. Now, select the performance measures file in the Open dialog box.

Using Text Wizard—Step 1. The text file will be displayed in a preview window. The performance measures data file does not match a predefined format, so choose "No" to the question in Step 1, and then choose "Next."

Text Wizard—Step 2. This step provides information about variables. A variable is similar to a field in a database. For example, each item in the questionnaire is a variable.

To read your data properly, the Text Wizard needs to know how to determine where the data value for one variable ends and the data value for the next variable begins. The arrangement of variables defines the method used to differentiate one variable from the next.

For the first question in Step 2, choose "Delimited." The data in the performance measures file should be in a delimited format. Spaces, commas, tabs, or other characters are used to separate variables.

In the second question, choose "Yes" to identify that variable names are included at the top of your file. This informs SPSS that the first row of the data file contains descriptive labels for each variable. Choose "Next" to continue to the next step.

Text Import Wizard: Step 2 of 6. How are your variables arranged? The delimited circle is checked. Are variable names included at the top of your file? The yes circle is checked. At the bottom is a preview of fictitious text.

Text Wizard Step 3: Delimited Files. This step provides information about cases. A case is similar to a record in a database. For example, each respondent to a questionnaire is a case.

The first question in Step 3 asks on which line number the first case of data begins. This indicates the first line of the data file that contains data values. Since the first line contains descriptive labels, you should choose "2" or the line number where the data begins if other than line 2.

The second question asks, "How are your cases represented?" This information informs the Text Wizard where each case ends and the next one begins. For this question choose "Each line represents a case."

Each line contains only one case. It is fairly common for each case to be contained on a single line (row), even though this can be a very long line for data files with a large number of variables. Cases with fewer data values are assigned missing values for the additional variables.

The third question asks, "How many cases do you want to import?" For this question select "All of the cases" in the data file. You may also choose to select "The first n cases" (n is the number you specify) or "A random percentage of the cases (approximate)."

Text Import Wizard: Step 3 of 6. There are boxes in which numbers are to be selected and circles are to be checked depending upon the answer to a question. The first case of data begins on which line number? 2 is chosen. How are your cases represented? Each line represents a case is selected. How many cases do you want to import? All of the cases is selected. At the bottom is a preview of fictitious text.

Text Wizard—Step 4: Delimited Files. This step displays the Text Wizard's best guess on how to read the data file and allows you to modify how the Text Wizard will read variables from the data file.

The first question asks, "Which delimiters appear between variables?" This indicates the characters or symbols that separate data values. You should select "Comma" and "Space."

The second question asks, "What is the text qualifier?" Characters are used to enclose values that contain delimiter characters. For example, if a comma is the delimiter, values that contain commas will be read incorrectly unless there is a text qualifier enclosing the value, preventing the commas in the value from being interpreted as delimiters between values. The text qualifier appears at both the beginning and the end of the value, enclosing the entire value. Performance measures data files use a double quotation mark (") as a text qualifier. Choose "Double quote" for this question and then hit "Next."

Text Import Wizard: Step 4 of 6. There are two questions. Which delimiters appear between variables? Boxes are checked for comma and space. What is the text qualifier? A box is checked for double quote.

Text Wizard Step 5. This step controls the variable name and the data format that the Text Wizard will use to read each variable and which variables will be included in the final data file. For this step you can choose to accept the variable names and the data format from the performance measures data (.txt) file by choosing "Next" and continuing to Step 6.

If you want to change this information, you can overwrite the default variable names with your own variable names. Select a variable in the preview window, and then enter a variable name. For information on variable naming rules, see "Variable Names." To change the data format, select a variable in the preview window, and then select a format from the drop-down list. Shift-click to select multiple contiguous variables, or Ctrl-click to select multiple noncontiguous variables.

Text Import Wizard: Step 5 of 6. A box labeled variable name contains the words survey I.D. A box labeled data format contains the word numeric. At the bottom is a preview of fictitious text.

Text Wizard—Step 6. This is the final step of the Text Wizard. You can save your specifications in a file for use when importing similar text data files. You can also paste the syntax generated by the Text Wizard into a syntax window.

Press the "Finish" button to complete the text import Wizard.

Text Import Wizard: Step 6 of 6. There is an image of a text file in the upper left hand corner. You have successfully defined the format of your text file. Would you like to save this file format for future use? No is checked. Would you like to paste the syntax? No is checked. Cache data locally is checked. At the bottom is a preview of fictitious text.

The data will appear in SPSS and will be ready to analyze.1

The S.P.S.S. screen. Column headings are survey I.D., begin time, end time, D11, D12, etc. Fictitious data are entered.

Data Transformation. After you transport the data into SPSS, you will need to transform some of the variables into numeric values for statistical analysis. This section describes how to recode string (alphanumeric) variables. You can recode variables using the "Automatic Recode" function or by manually transforming the data into the "Same Variable" or into "Different Variables." Transforming data into numeric values will allow you to conduct more sophisticated statistical analysis on the data.

Automatic Recode. "Automatic Recode" converts string and numeric values into consecutive integers. String values are recoded in alphabetical order, with uppercase letters preceding their lowercase counterparts.

To automatically recode variables, go to the menu and choose "Transform." Then choose "Automatic Recode." You will need to specify the variables to be recoded and the new name of the variables. You will also need to identify whether you want the data to start recoding from the lowest value or the highest value.

Recode into Same Variables. You can recode data into the same variables (the same row), which will reassign the values of existing variables or collapse ranges of existing values into new values. For example, you can recode a "True" response to be 1, and a "False" response to be 2 for easier analysis. It is important to make note of the original question response and the value you assign to each response for analysis of the data. 

To transform data, go to the menu and choose "Transform," then choose "Recode," and then choose "Into Same Variables." Select the variables you want to recode.

Recode into Different Variables. You can also recode into different variables, which will reassign the values of existing variables or collapse ranges of existing values into new values for a new variable. This function allows you to keep the old variable and create a new variable with numeric values.

To transform data, go to the menu and choose "Transform," then choose "Recode," and then choose "Into Different Variables." Select the variables you want to recode.


1. SPSS Base 12.0 User's Guide (2003). SPSS Inc. Chicago, IL. More information can be found at http://www.spss.com.


Return to Contents
Proceed to Next Section