Public Health Emergency Preparedness
This resource was part of AHRQ's Public Health Emergency Preparedness program, which was discontinued on June 30, 2011, in a realignment of Federal efforts.
This information is for reference purposes only. It was current when produced and may now be outdated. Archive material is no longer maintained, and some links may not work. Persons with disabilities having difficulty accessing this information should contact us at: https://info.ahrq.gov. Let us know the nature of the problem, the Web address of what you want, and your contact information.
Please go to www.ahrq.gov for current information.
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.
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
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.
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 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"
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 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 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
Press the "Finish" button to complete the text import Wizard.
The data will appear in SPSS and will be ready to analyze.1
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