Inputting a two-by-two table into SPSS

Steve Simon


This page is currently being updated from the earlier version of my website. Sorry that it is not yet fully available.

*Dear Professor Mean

::: {align=“left”}

            **D+**    **D-**    **Total**
**F+**     **34**    **23**     **57**
**F-**     **139**   **119**    **258**

Total 173 142 315


*When I try to enter this data into SPSS

Dear Jinxed,

You have values ranging from F- to D+? I hope this isn’t data on the grades you received in college.

Actually these data are from a paper: Sands et al (1999). F+ represents presence of a risk factor (in this case

::: {align=“left”}

   **Risk       **Group**   **Number/Total     **Odds Ratio
  Factor**                     (Percent)**         (95%CI)**

Miscarriage VSD 34/173 (20%) 1.3 (0.7,2.3) Control 23/142 (16%)

 **Female**       **VSD     **84/173 (49%)   **2.1 (1.3,3.2)**
                 Control**   60/142 (42%)**   

Low parity VSD 76/173 (44%) 1.1 (0.7,1.8) Control 58/142 (41%)

 **Smoking**      **VSD     **41/173 (24%)   **0.8 (0.5,1.3)**
                 Control**   39/139 (28%)**   

 **Alcohol**      **VSD     **18/173 (10%)   **0.7 (0.4,1.5)**
                 Control**   20/139 (14%)**   


Notice that we have to do a bit of arithmetic to get all the values. **If 34 out of 173 VSD cases had a previous miscarriage

For data like this

To re-arrange the data

Here’s what your re-arranged data would look like

**Enter the data

Then select Analyze | Descriptive Statistics | Crosstabs from the SPSS menu to create a two by two table.

Be sure to click on the Statistics button and select the Risk option box to ask SPSS to compute the risk ratios.

I also usually find it useful to display the row percentages. To do this

In the Crosstabs: Cell Display dialog box

Here’s what the first part of the output looks like.

Notice that the rows and columns are reversed in this table. There are several ways to change how the table is displayed

Here is what the second part of the output looks like.

By the way


Jinxed Jason can’t figure out how to enter data from a two by two table into SPSS. Professor Mean explains that you need three variables to represent a two by two table. The first variable indicates the specific column of your table and the second variable indicates the specific row (or vice versa). The third variable indicates the count or frequency for each intersection of row and column. You do not include the row or column totals in your data entry. You can then select Analyze | Descriptive Statistics | Crosstabs from the SPSS menu to analyze the data from your two by two table. You get additional analyses by selecting the Risk and/or Chi-square option boxes.

Further reading

  1. Incidence and risk factors for ventricular septal defect in “low risk” neonates. Sands AJ

You can find an earlier version of this page on my original website.