**P.Mean: Entering and analyzing data from
a two by two table, using PASW/SPSS (created 2009-12-14)**.

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. The table shown below presents some data and statistics from several two by two crosstabulations. How do you take information like this and enter it into PASW/SPSS, so that you can produce a useful analysis?

**Step 1. Take data from a publication and arrange it in a two by two
table.**

The information shown above is the typical way in which data from a two by two table is displayed in a research publication. It doesn't look like a two by two table, but it has all the information you need to construct such a table.

A two by two table is a tabular display of counts involving a binary variable cross-classified with a second binary variable. The two by two table consists of nine numbers (not four), since the four counts of the possible combinations of the binary variables are supplemented by two row totals, two column totals, and a grand total.

Most papers will display only some of the nine numbers, but you can usually construct the missing numbers with a bit of care and patients.

Shown above is the complete two by two table examining the association between smoking and birth defects.

Show me how you did this. ( text / video )

**Step 2. Take data from a two by two table and restructure it for data
entry into PASW Statistics/SPSS**.

The typical two by two table, however, cannot be entered directly into PASW Statistics/SPSS. Instead, you need to restructure the data. Create a new variable representing the row number, another new variable representing the column number, and a third variable representing count.

Shown above is what the layout would look like for this particular example.

Show me how you did this. ( text / video )

**Step 3. Document the data set and enter it into PASW Statistics/SPSS.**

When you enter the data into PASW/SPSS, be sure to set value labels so your table is displayed with appropriate information.

Shown above is what the data looks like in PASW/SPSS.

Show me how you did this. ( text / video )

**Step 4. Weight cases **

Before you analyze the data, you need to weight the data, so that PASW/SPSS understands that the first row of data corresponds to 41 patients and the last row of data corresponds to 100 patients.

Show me how you did this. ( text / video )

**Step 5. Produce crosstabulations**

The tables above show some of the output from the CROSSTABS procedure.

Show me how you did this. ( text / video )Note that I intentionally used a coding system that changed the order in which the rows and columns are displayed. There are situations where you may prefer one ordering or another for the rows and columns, and you should get comfortable with the fact that the way that you first get the tables displayed within PASW/SPSS may not be the best choice.

**Step 6. Remember that you'll get weird results if you don't weight
cases.**

Always be careful to weight the data in an example like this. If you forget, you will get some very bad results.

The tables above show what happens if you fail to weight the data.

Show me how you did this. ( text / video )

This work is licensed under a Creative Commons Attribution 3.0 United States License. This page was written by Steve Simon and was last modified on 2017-06-15. Need more information? I have a page with general help resources. You can also browse for pages similar to this one at Category: SPSS software.