SPSS >

Introduction to SPSS 10.0


Reprint rights to the information in this publication may be assumed for noncommercial purposes.

Table of Contents

Introduction

For Starters
Data Editor, Syntax Editor, and Output Viewer
Menu Commands in the Data Editor
Creating a New Data Set
Defining Variables
Entering Data
Saving Your Data
Retrieving SPSS Data Files
Importing Non-SPSS Data
Importing from Excel
Freefield and Fixed Format Data - Which Is Which?
Importing Freefield Data
Importing Fixed Format Data
 

Transforming Variables

Transforming Variables with the Compute Command
Transforming Variables with the Recode Command
Using the "If" Statement in Transformations
Analyzing Your Data
Running Frequencies
Adding Graphics to Your Analysis
Saving, Printing, and Exiting SPSS


Setting Your Preferences

A Practice Exercise

Selected Glossary

 


1. Introduction

SPSS version 10.0 for Windows is a statistical software package that allows users to create, access, manipulate, and analyze data.

The purpose of this document is to introduce new users to the SPSS for Windows environment. After reading this document, the student should be able to:

  1. Manipulate application windows and use the menu system.
  2. Create data files.
  3. Access preexisting data files.
  4. Transform data.
  5. Create supporting graphs.
  6. Save and print results.

Users of SPSS for Windows should have experience operating within a Windows environment (95, 98 or NT). In addition, an understanding of basic statistical techniques and prior programming experience using other statistical programs is beneficial.


2. For Starters

To open SPSS, do the following:

  • Click on the START button on the Window taskbar.
  • Go to the PROGRAMS folder tab, then the SPSS for Windows folder tab.
  • Click once to highlight the SPSS 10.0 for Windows icon to enter the program.

    OR -

  • Double-click the SPSS icon on the Windows desktop.

a. Data Editor, Syntax Editor, and Output Viewer

SPSS consists of three parts: The Data Editor, the Syntax Editor, and the Output Viewer: When you start SPSS, the Data Editor window opens by default. It allows you to create your data set and perform statistical operations (Figure 1).

FIGURE 1: The Data Editor

 

The Syntax Editor fulfills the same function as the Data Editor. However, in the Data Editor you manipulate your data set interactively by using the pull-down menus. You use the Syntax Editor to achieve the same results by writing the procedures in the SPSS programming language (Figure 2). To open the Syntax Editor, go to the menu bar and click on FILE, click NEW, and click SYNTAX.

FIGURE 2: The Syntax Editor

 

The Output Viewer displays the results of statistical operations you perform on your data. It pops up automatically once you run a statistical procedure (Figure 3).

FIGURE 3: The Output Viewer

 

b. Menu Commands in the Data Editor

The menu options you have vary, depending whether you are in the Data Editor, the Syntax Editor, or the Output Viewer.

The Data menu:This menu provides techniques for defining variables, inserting variables or cases, sorting files, splitting files, merging data sets, aggregating data, or using a select command to look at a subgroup within the data file.

The Transform menu allows you to transform your data set on the basis of existing variables. Among other things, you can recode your variables and compute new variables from existing ones..

With the Analyze menu you perform statistical operations on your data set, the output of which will be displayed in the Output Viewer.

The Graphs menu contains a number of graph options that allow you to visually display descriptive statistics in the Output Viewer.

The Utilities menu provides several miscellaneous functions. UTILITIES/VARIABLES for example, allows you to view the properties of your variables as you defined them on the Variable View tab in the Data Editor (see Figure 4).

Use the Help menu if you are looking for information on a specific subject. For that purpose, go to HELP/TOPICS, and select the "Index" tab. Then, type the word you are looking for on the white line and click the "Display" button. To get a general idea of how SPSS works, go to HELP/TUTORIAL. This function provides a step-by-step introduction to the most important topics on SPSS.

 

NOTE: If you run statistical operations and need help understanding your output, in the Output Viewer right-click on the table containing your statistics and go to the "Results Coach" option. This option will tell you what your table contents actually mean.

 


3. Creating a New Data Set

In this section you will learn the steps involved in creating your own data file, using the Data Editor. Several steps are involved when it comes to creating a new data set. First, you have to tell SPSS whether to treat your variables as numeric or string variables, how many decimals to record etc. You do this by defining your variables. Once you have done that, you enter your actual data.

a. Defining Variables

The Data Editor window has two sheets: A Data View sheet, and a Variable View Sheet. By default the Data View sheet opens whenever you open the Data Editor. The Data View Sheet contains your actual data set. Here, the variable names are displayed in the grey row right above line 1. Each white row represents a case, and each column represents a variable.

To define your variables, click on the Variable View tab at the bottom of the screen. The Variable View Sheet opens (Figure 4). It allows you to name your variables, to identify missing values, assign variable and value labels, adjust column width and alignment, and format the column for the type of data you are planning to enter.

FIGURE 4: The Data Editor in Variable View

back to info on the Utilities menu.

In Variable View, each variable takes up one row. The columns contain the formatting options:

 

Name: Use the default SPSS variable name indicated by VAR00001 or create your own name for the variable. The name is limited to eight characters and can be any combination of letters and numbers as long as it does not start with a number; e.g. AGE, SEX, INCOME. Each variable name must be unique; no duplicate names are allowed. In addition, spaces are not allowed and special characters (@,#,$,%) and punctuation marks should be avoided.
Type:There are several options in defining the type of data. The two most commonly used are numeric and string variables. Numeric (the default) indicates to SPSS that the data entered for this variable will only be numbers. If you wish to put names, words, or a combination of numbers and letters, you must format the column type as a string variable. Please note that SPSS does not allow you to perform operations on variables that are defined as string.
Label: Define a descriptive variable label, which appears in your statistical reports and charts. It can be up to 120 characters long.
Value: Define value labels, which can be up to 60 characters in length. Value labels are especially useful when numeric codes are used to represent non-numeric categories such as sex or race. NOTE: Many procedures will not print the maximum number of characters allowed for variable and value labels. The best approach is to keep both variable and value labels as short as possible; generally no more than 40 characters for variable labels and 20 characters for value labels.
Missing: Blank cells in the data set are automatically identified as system-missing values and are represented by a period (.) on the Data View sheet. Instead of leaving the data entry blank, values are sometimes used to represent why data are not available. An example would be a survey question that recorded "don't know" or "refused to answer" responses by a specific value, such as 8 and 9. To exclude these two responses from your analysis you can use the Missing Values option to identify them as user-missing values. SPSS treats system-missing and user-missing values the same; they are excluded from the data analysis.
After defining the variable, you return to the Data View sheet by clicking the data view tab at the bottom of the screen.

 

b. Entering Data

In Data View, you enter your data just as you would in a spreadsheet program. You can move from cell to cell with the arrow keys on your keyboard or by clicking on the cell with the mouse. Once one case (row) is complete, begin entering another case at the beginning of the next row. You can delete a row of data by clicking on the row number at the far left and pushing the delete key on your keyboard. In a similar fashion, you delete a variable (column) by clicking on the variable name so that the entire column is highlighted and pushing the delete key.

 

c. Saving Your Data

To save a data file select the FILE pull-down menu and then use the SAVE option. Type the drive, folder, and file name and click OK to save the file. This saves the data as an SPSS for Windows system file and sets the file name extension as .sav. This file can only be read by the SPSS for Windows program, unless the user is very proficient in SAS. There are other options (under SAVE FILE as Type) which allow you to save the data in ASCII, tab-delimited, SPSS/PC+ for DOS, Microsoft Excel, and several other formats.


4. Retrieving SPSS Data Files

To retrieve an SPSS data file, from the FILE menu single-click on the option OPEN, then single-click on the option DATA. This will produce the Open Data File dialog box.

NOTE: For writing and explanatory ease, menu steps may be separated by a slash from this point forward; e.g. FILE/OPEN/DATA.

Type in the location and name of the data file or use Windows Explorer to locate your file by establishing the drive and folder that contains your files and selecting the file with a single click. In most cases your file will be on floppy drive A:\ or network drive G:\, which is the drive that has your login name as a label.

After identifying the file, click the OK button.

 

5. Importing Non-SPSS Data

a. Importing from Excel

The SPSS Data Editor can read files written in Excel 97. Just go to FILE/OPEN/DATA. As the "Open File" dialog box pops up, select the appropriate drive and folder. In the "Files of Type" field, make sure Excel is selected. Highlight the file you wish to open, then click "Okay".

 

b. Freefield and Fixed Format Data - Which Is Which?

Some data sets come as unformatted "text" files such as the ASCII files that can be saved by text editors (e.g. WordPad or Notepad). Among these data sets, two types can be distinguished:

  • Data sets that contain freefield data (Figure 5): Each case constitutes a line. The variables are recorded in the same order for each case and separated from each other by a delimiter, usually a blank or a comma.
  • Data sets that contain fixed format data (Figure 6): Here each case constitutes a line, and variables are recorded in fixed columns. An example of this are ICPSR data sets (ICPSR stands for "Inter-University Consortium for Political and Social Research"). Because variables are located in fixed columns, you do not have to import the entire data set, but can select the variables of your choice by specifying the appropriate columns. This is useful in cases when you are dealing with large data sets that take up a lot of memory.

Figure 5: A Freefield Data Det - freefiel.txt

Figure 6: Fixed Format Data - speed.txt.

c. Importing Freefield Data

To import freefield data, take the following steps: In the Data Editor, go to FILE/READ TEXT DATA. In the "Open File" dialog box, select the text file you wish to import and click "Open." The "Text Import Wizard" will pop up and guide you through the remaining steps you need to follow. In step 2 you will be asked "How are your variables arranged?" Be sure to select the option "delimited." Once you have read your data into the Data Editor, you can specify variable labels, value labels etc. (Figure 7).

Figure 7: Importing freefiel.txt with the Text Import Wizard

 

d. Importing Fixed Format Data

Using the Data Editor

You can import fixed format data through the Data Editor. As before, go to FILE/READ TEXT DATA. In the "Open File" dialog box, select the text file you wish to import and click "Open." The "Text Import Wizard" will pop up and guide you through the remaining steps you need to follow. In step 2 select the option "Fixed Width," to answer the question "How are your variables arranged?"

Using the Syntax Editor

If you are dealing with large data sets and want to import only certain variables, you have to do that through the Syntax Editor in programming language. The basic steps you have to follow are:

  1. Specify an SPSS name for the data and tell SPSS where to locate the data set. You do this with the FILE HANDLE command. Think of the SPSS name for the data set as a working title. This working title, which must not be longer than eight characters, tells SPSS how to refer to the file it finds at the specified location on your computer. This working title is only used by the SPSS Syntax Editor. It has nothing to do with the actual file name of the data set.
  2. Specify name and column location for each variable you wish to import, and determine its format (string or numeric? If numeric, how many decimals?). You do this with the DATA LIST command.
  3. Specify variable labels for your data (optional). You do this with the VARIABLE LABELS command.
  4. Specify value labels (optional). You do this with the VALUE LABELS command.
  5. Tell SPSS to execute steps 1 through 4. You do this with the EXECUTE command.

To illustrate how these steps are carried out, we will import the data set speed.txt (see Figure 6), executing the steps just listed. The data set is a fixed format text file which contains the records of sprinters: Their I.D. number, their name, age, weight, speed and level of exhaustion. It is saved on a floppy disk .

1. FILE HANDLE

FILE HANDLE example / NAME='a:\speed.txt'.

Type the command FILE HANDLE, followed by an SPSS name for your data set. Then insert a slash and the NAME command. The file location has to be enclosed by simple quotation marks.

NOTE: As you can see, SPSS syntax uses slashes "/" and periods ".". The slash is used to indicate subcommands (FILE HANDLE is the command, NAME is the subcommand). The period indicates the end of a command (including subcommands). In our case the period signifies the end of the FILE HANDLE command.
SPSS syntax is not case sensitive. You do not need to use caps to identify the commands, but it might want to do it anyway to set the commands off.
Finally, be careful when typing your syntax. If your program contains typing errors, it will not be executed.

2. DATA LIST

DATA LIST file = example/
ID 1
Name 2-10 (A)
age 11-12
speed 17-19 (1)
exhaust 20
.

The DATA LIST command is followed by the working title of the file - in our case this is "example." Insert a slash after the working title to indicate that variable names, locations and format are next. Variable names - in our case "ID", "Name", "age", "speed", and "exhaust".

The variable names are followed by their respective column numbers. The variable format follows in parentheses. If no format is specified, SPSS will read the variable as numeric with zero decimals. The number "1" tells SPSS to insert a decimal point before the last digit. "2" would tell SPSS to insert a decimal point before the last two digits. The letter "A" indicates that the variable in question is a string variable.

Note that we omitted the weight variable, which is recorded in columns 13 through 16, because for the purpose of our data analysis we do not need it. The last variable is followed by a period to indicate the end of the DATA LIST command.

3. VARIABLE LABELS

VARIABLE LABELS
ID "ID number of the sprinter"
Name "name of the sprinter"
age "age of the sprinter"
speed "speed in m/sec"
exhaust "Was sprinter exhausted?"
.

Type the command followed. Then type the variable names, followed by the variable labels in quotation marks. Insert a period at the end of the command.

4. VALUE LABELS

VALUES LABLES
exhausted 1 "yes"
2 "no"
.

You might want to specify value labels for categorical data. In our example, we do this for the variable "exhaust." Write out the name of the variable, then list the numbers, followed by the labels in quotation marks. Insert a period after the last variable for which value labels are assigned, to indicate the end of the VALUE LABELS command.

5. EXECUTE

EXECUTE.

Again, be sure to insert a period after the EXECUTE command. To run the program, highlight it and click on the "run" arrow on the tool bar. SPSS will import the data set into the Data Editor. Save the SPSS data set in a folder and under a file name of your choice.

Figure 8: The Syntax its Entirety

 

Figure 9: The Data Set in the Data Editor


6. Transforming Variables

In the Data Editor, you can use the COMPUTE or the RECODE command to create new variables from existing variables.

a. Transforming Variables with the Compute Command

The COMPUTE option allows you to arithmetically combine or alter variables and place the resulting value under a new variable name. As an example, to calculate the area of shapes based on their height and width, you compute a new variable "area" by multiplying "height" and "width" with one another (Figure 10):

  1. Using the menu system select TRANSFORM/COMPUTE, enter the target variable name AREA and in the numeric expression box type HEIGHT*WIDTH.
  2. Click the OK button to have the transformation run immediately or the PASTE button to copy the proper commands to the Syntax Editor. The OK button will only appear after a target variable and numeric expression are provided.

Note: The PASTE button allows you to develop a complete program in the Syntax Editor that will list all the commands used in your current SPSS session. This program can be saved for future reference. .

FIGURE 10: The Compute Dialog Box

back to "Using the IF Statement"

b. Transforming Variables with the Recode Command

The RECODE option allows you to create discrete categories from continuous variables (Figure 11). As an example, you may want to change the height variable where values can range from 0 to over 100 into a variable that only contains the categories tall, medium, and short.

FIGURE 11: The Recode dialog box

back to "Using the IF Statement"

  1. Select TRANSFORM/RECODE/INTO DIFFERENT VARIABLES.
  2. A list of variables in the active data set are provided. Select the variable you wish to change by clicking once on the variable name and clicking the arrow button.
  3. Click the Output Variable box and enter a new variable name (8 characters maximum) and click CHANGE.
  4. Select OLD AND NEW VALUES. This box presents several recoding options. You identify one value or a range of values from the old variable and indicate how these values will be coded in the new variable. After identifying one value category or range, enter the value for the new variable in the New Value box. In our example, the old values might be 0 through 10, and the new value might be 1 (the value label for 1 would be "short", for 2 "medium", for 3 "tall").
  5. Click ADD and repeat the process until each value of the new variable is properly defined (Figure 12).
  6. Click CONTINUE to return to the Recode box and OK to return to the Data Editor.
    NOTE: In dialog boxes that are used for mathematical or statistical operations, only those variables that you defined as numeric will be displayed. String variables will not be displayed in the variable lists.

FIGURE 12: Recode: Old and new values

 

WARNING: You also have the option of recoding a variable into the same name. If you did this in the height example, the working data file would change all height data to the three categories (a value of 1 for "short"), 2 ("for medium", or 3 for "tall"). If you save this file with the same name, you will lose all of the original income data . The best way to avoid this is to always use the recode option that creates a different variable. Saving the data file keeps the original income data intact while adding the new categorized variable to the data set for future use.

 

 

c. Using the "If" Statement in Transformations

Using the IF statement in the Data Editor:
Within the COMPUTE and RECODE commands is an option to use an IF statement. You can choose to only recode values if one of your variables satisfies a condition of your choice. This condition, which is captured by means of the "IF" command, can be simple (such as "if area=15). To create more sophisticated conditions, you can employ logical transformations using AND, OR, NOT.

  1. In the Compute and Recode dialog boxes (Figures 10 and 11), click on the IF button.
  2. The Include If Case Satisfies Condition dialog pops up(Figures 13 and 14).
  3. Select the variable of interest and click the arrow button.
  4. Use the key pad provided in the dialog box or type in the appropriate completion of the IF statement.
  5. When the IF statement is complete, click CONTINUE.

FIGURE 13: The "Include Cases If" dialog box for the RECODE command

FIGURE 14: The "Include Cases If" dialog boxes for the COMPUTE command

Using the IF statement in Syntax
For experienced users, the best method for using the IF statement is to enter it directly into the Syntax Editor. Here are some examples of appropriate syntax statements using the logical operators "and", "or", "not":

  1. "and" [Both conditions must exist for BUY to be assigned the value of 1.]
    IF (HEIGHT =10 AND WIDTH = 5) BUY=1.
    EXECUTE.
  2. "or" [If any of the conditions exist, BUY will be assigned the value of 1.]
    IF (HEIGHT=10 OR HEIGHT=9 OR WIDTH=5) BUY=1.
    EXECUTE.
  3. "not" [Reverses the outcome of an expression.]
    IF NOT(HEIGHT=10 OR HEIGHT=9 OR WIDTH=5) BUY=2
    EXECUTE.

The IF command also can process the following mathematical operators (given here in syntax):

EQ or = "equals"
LT or < "less than"
GT or > "greater than"
LE or <= "less than or equal to"
GE or >= "greater than or equal to"
NE or <> "not equal to"
Example: IF (HEIGHT LE 5) HEIGHT_B=1. EXECUTE.

NOTE: For highlighting long programs in the Syntax Editor, use Ctrl-Home to move to the beginning of the program then Ctrl-Shift-End to highlight the entire program.

 


 

7. Analyzing Your Data

Once you have opened or created a data set, you can immediately begin your analysis. Under the ANALYZE menu there are several options available. The DESCRIPTIVE STATISTICS option is discussed here, as it is used most often in basic statistical analysis. Using the menu bar select ANALYZE/DESCRIPTIVE STATISTICS. This provides you with the choice between running frequencies, descriptives (mean, median, mode etc.), crosstabs and summary statistics (under the EXPLORE option). Within each choice you can select the type of statistics you desire, format of the table, and for some statistical procedures graphical representations of the data (use the CHARTS button).

a. Running Frequencies

To run frequencies, select ANALYZE/DESCRIPTIVE STATISTICS/FREQUENCIES. The list of variables for the active data set are provided . Highlight the variable(s) of interest and click the arrow key to include the variable(s) in your analysis (Figure 15). Once you select the variables and indicate the type of statistics you want, you have the choice of running the analysis immediately by clicking OK or pasting the commands into the Syntax Editor to create a program file.

FIGURE 15: Running frequencies for the variable height_b

back to "Setting your Preferences"

As the program begins to run, the Output Viewer will be activated. Once you are in the Output Viewer, you can page through the output and print the results. You can also insert text. To do that, place the insertion point where you want the text box to appear, and go to INSERT pull-down menu and select NEW TEXT.

To save your output file go to the FILE pull-down menu and click on SAVE. The default extension for an output file when saving is .spo, as opposed to the .sav for data files, so files for the same program may be saved with the identical names, different extensions.

 

b. Adding Graphics to Your Analysis

In the Data Editor, you can request graphic operations as an option directly through the GRAPHS menu. You can also do it through the statistical operations you are running. Let's take our example from Figure 15, where we ran the frequencies for the variable HEIGHT_B. In the "Frequencies" dialog box, click the "Charts" button. This will call up a list of chart options. Check the "Bar Charts" option and click "Continue" and then "OK". The Output Viewer will display the frequencies for HEIGHT_B not only in table format, but also as a bar chart

Clicking twice on the icon will take you to the Chart Editor, where you can view and edit the graph (Figure 16). You can close the Chart Editor by clicking the "close" button in the upper right corner of the window. This will take you back to the regular Output Viewer. All the changes you made to your graph in the Chart Editor will be saved if you save your output file.

 

FIGURE 16: Frequency Bar chart for the variable height_b

 


8. Saving, Printing, and Exiting SPSS

To save data, program syntax, output, or charts, select the FILE menu and either use the option SAVE or SAVE AS. If the file you wish to save has been saved before, the SAVE option will automatically save it under the same name and file format in the previously designated location.

If it has not been saved before, the SAVE option will prompt you for a name, directory, and disk location (drive). If the file has been saved before but you wish to save it under a different name, location, or format, use the SAVE AS option. Syntax files are saved in ASCII format so they can be imported easily into other programs. Output files are saved with the .spo extension, and can only be opened in SPSS.The common file extensions used by SPSS are .spo for output files and .sps or .txt for syntax files. A good rule of thumb is to copy and paste desired output into Microsoft Word before printing. If you do that, be sure to use the "Paste Special" command in Word, rather than the simple "Paste command". Then, when prompted for a pasting option, choose "Paste as picture."

To print output, program syntax, charts, or the data file, select the FILE menu and then the option PRINT.

You exit SPSS by selecting FILE/EXIT. If you have not saved the data, output, or syntax files or they have changed since you last saved them, you will be asked to save the files before exiting. You can either save the files or decide to exit without saving.

 


9. Setting Your Preferences

Immediately after entering SPSS for Windows you should routinely check the OPTIONS dialog box under the EDIT menu. This dialog box establishes default settings for memory allocation, graph drawings, and output formats. In particular, the output options should be set so that your output includes commands, errors and warnings (to do this, go to the "Viewer" tab, and on that tab to the box that says "Initial Output State"). Ensure page size and length are set to standard (on the Viewer tab go to the box that says "Text Output Page Size").

Another option that you need to know about is contained on the "General" tab: The "Variable Lists" box on that tab allows you to modify the way your variables are displayed on dialog box variable lists (see Figure 15 for an example). You can display your variables in alphabetical order or in the order in which they appear in your data set. You can also display the variable labels rather than the variable names. This option is particularly important when you are dealing with large data sets, because if the variables are not arranged in an orderly manner, finding them on the dialog display list might take a long time.

 


 

10. A Practice Exercise

In this exercise, we will enter the results of a very simple survey we conducted. We conducted the survey because we want to know whether love for baseball varies with age. In order to get at that information, we asked 20 randomly chosen individuals about their age and about whether or not they love baseball. If they loved baseball, we recorded their answer as 1. If they did not love baseball, we recorded their answer as 2. If they were not sure whether they loved baseball, we recorded their answer as 3. If they refused to answer this question, we recorded that as 4 for "no answer."

In order to analyze the information our respondents gave us, we enter the data into the SPSS Data Editor.

First, we define our variables:

In the Data Editor, click on the "Variable View" tab. First, let's deal with the "age" variable. All the information defining this variable is entered in the first row of the spreadsheet. For name, we enter "age". For type, we click on the button that appears when we access the cell. A dialog box pops up. Because age is recorded as a number, we check the option "Numeric." For width, we enter "2", because all our respondents are between 0 and 99 years old, and therefore we only need two digits (however, you can also choose any number that is greater than that. The important thing is that you select a number that is greater than or equal to the maximum number of digits, decimals included, your values can assume). For decimals, we select "0", because we recorded age as integers, and we are not interested in displaying decimals. For label, we enter "age of respondent". We skip the values cell, because age is not a categorical variable, and therefore there is no need to define value labels. We also skip the missing cell, because for the age variable, there are not missing values. Skip columns and align, and for measure, select "interval", since age is an interval scale variable.

Now the variable that records the respondents' love for baseball:

  • name: "baseball"
  • type: "numeric"
  • width: "1"
  • decimals: "0"
  • label: "Does respondent love baseball?"
  • values: Click on the button that appears when you select the cell. For "value" type "1", for "value label" type "yes", then click the add button. In the same manner, you define "2" as "no", "3" as "not sure", and "4" as "no answer". The reason why we use value labels for the BASEBALL variable is that this variable consists of categories (yes, no, don't know), that can be labeled.
  • missing: Enter "4". If a respondent gave no answer, his/her case will be excluded in statistical analyses involving the BASEBALL variable.
  • Skip columns and align.
  • measure: select "nominal".

As our next step, we enter the data from the twenty questionnaires we had our respondent fill out. To do that, click on the "Data View" tab on the lower left of the screen. Now you see a line of grey cells, with the first two reading "age" and "baseball", respectively. These are the variable names we just defined.

Since every white line represents one case, each respondent's answers are entered into one line.

 

FIGURE 17: Entering the data into the Data Editor

age baseball
10 1
15 1
16 1
20 1
13 1
7 2 2
35 3
40 3
50 3
50 2
77 2
21 1
81 4
44 2
32 2
8 4
9 2
11 1
12 1
55 1

 

 



 

Now we save the file on a floppy disk. Go to FILE/SAVE AS. In the dialog box that pops up, browse for the a-drive. Choose a file name, for example "exercise" and hit the SAVE button.

Now that you have the data in SPSS, you can analyze it. First, let's transform AGE into a variable consisting of discrete categories (AGE_REC), which we can then cross-tabulate with the variable BASEBALL.

Go to TRANSFORM/RECODE/INTO DIFFERENT VARIABLES. In the "Recode" dialog box, highlight AGE, and put it into the Input->Output list by clicking on the little arrow. Name the output variable "AGE_REC" and label it "age recoded". Click on the "change" button, then click on the button that says "Old And New Values". The "Old and New Values" dialog box pops up. For "Old Value", check the "Range" bullet, and enter "1" through "15". For "New Value", enter "1" and click on the "Add" button. For "16 through 35" enter "2" and click on the "Add" button. In a similar fashion, you recode the values "36" through "99" into the new value "3". Then click on the "continue" button. Then click the "OK" button.

A new variable is added to your Data View. Since the new variable does not have value labels yet, we go into Variable View and enter the value labels. In the values cell, we assign the label "1-15" to the value "1", the label "16-35" to the value "2", and the label "36-99" to the value 3. In the decimals cell we reduce the number of decimals to zero. This makes it easier to read the data.

Now we can run the crosstabs.

To do that, go to ANALYZE/DESCRIPTIVE STATISTICS/CROSSTABS. For "Rows" enter BASEBALL, for column enter AGE_REC. Click the "OK" button.

In the Output Viewer, you can now see the results of your analysis (Figure 18). From the table you can see that the older the respondents get, the less likely they are to answer the question "Do you love baseball?" with "yes." Also, fifty percent of those who answered "no", are in the 36-99 age bracket. You could read this as tentative evidence for the hypothesis that love for baseball varies with age.

Note that the total number of cases included in the crosstabulation is 18, even though we interviewed 20 individuals. The reason for this is that two respondents refused to answer the question, and we coded that refusal as a missing value, to be excluded from statistical analyses.

Figure 18: AGE_REC and BASEBALL crosstabulated

 


 

11. Selected Glossary

  • ASCII files:Standard DOS format that can be imported by other software packages.
  • Comma delimited: A special free-format data file where each variable is separated by a comma.
  • Fixed format: Data for each variable are arranged in a specific column and row of the data file.
  • Free format: Data for each variable are arranged and identified by their relative position with the other variables.
  • Numeric variables: Data that are recorded in a numeric format (i.e. numbers).
  • String variables: Data that are not recorded in a numeric format (i.e. words).
  • Syntax: Programming statements and commands which guide SPSS operations.

For an exellent and detailed introduction to SPPS 10.0, please consult the SPSS tutorial, which you can find on the SPSS help menu.