Two by two table >> Part 3 (created 2009-12-14)

This page is moving to a new website.

One of the most common questions I hear is how to enter and analyze data from a two by two crosstabulation. It is not immediately obvious, especially to beginners, how to get started with this type of data. This is part 3 of a series of 6 handouts on this topic (view handouts 1, 2, 4, 5, 6). There is also a video version of this topic. Part 3 explains how to set up variables and their value labels in PASW/SPSS and enter the relevant information.

The data shown above has been restructured so that you can enter it into PASW/SPSS.

In the PASW Statistics Data Editor, click on the VARIABLE VIEW tab at the bottom left. This displays a page (shown above) that allows you to enter variable names and documentation.

Enter "Risk.Factor" as the name of the first variable.

When you press the ENTER key after typing "Risk.Factor", PASW/SPSS selects the default variable type, numeric with a width of 8 and 2 decimals. This is a good choice for "Risk.Factor" because I will be using number codes. I do, however, want to change the number of decimals from 2 to 0.

Next click in the VALUES field for this variable. A button with three dots appears on the right. Click on this button.

The dialog box shown above allows you to enter value labels. Type "1" in the VALUE field and "Miscarriage" in the LABEL field. This tells PASW/SPSS that a numeric code of "1" in the variable "Risk.Factor" should be displayed in any tables and graphs with the word "Miscarriage".

Next add "0" and "No". Notice that PASW/SPSS sorts these labels numerically. When this second value label is added, click on the OK button.

Now add "Outcome" as the name of the second variable. Again, we are happy with the default choice of Numeric, but we want 0 decimals rather than 2.

The value labels for "Outcome" (shown above) are "Control" (0) and "Defects" (1).

The name of the third variable is "Count". Again select 0 decimals. There is no need to specify value labels for "Count" since it is not a categorical variable.

Click on the DATA VIEW tab in the lower left corner. This allows you to enter your data.

This shows the number codes for "Risk.Factor" and "Outcome".

Select VIEW | VALUE LABELS from the menu to toggle between number codes and the value labels.

This is the display with value labels. I usually like to see number codes during data entry and value labels during data analysis.

Add the four counts.

Get in the habit of saving your data early and often. Select FILE | SAVE from the menu to get this dialog box.

After you have saved the data, look at the PASW Statistics Viewer. The message shown above reminds you that you have saved the data.