Tabulating Grid and Loop Slices

Sometimes you may want to tabulate the results of one iteration of a grid or loop against another variable. An iteration of a grid or loop is sometimes called a slice. Although you cannot create grid tables when you are using the flat view of the data, you can tabulate grid and loop slices. The examples in this topic use the Household sample, which uses the hierarchical view and cannot be represented in a flat form. However, the main principles of working with grid and loop slices are the same in both the hierarchical and the flat view and this topic explains the differences.

To tabulate a slice of a grid variable

In the Household sample data set, suppose you want to tabulate the rating that respondents gave to the vehicle's comfort by another variable (such as the vehicle type). Here is the grid question with the comfort slice highlighted:

To create a crosstabulation of this grid slice by the vehicletype variable:

Create a new table.

In the Variables pane, expand the vehicle loop.

Drag the vehicletype variable that is nested within the loop and drop it on the Add button on the side of the table:

In the Variables pane, expand the rating grid that is inside the vehicle loop, and then expand the Column variable that is inside the rating grid.

Select the Comfort slice and choose Add on the top of the table.

Choose the Generate table button:

Here is the table:

To tabulate a slice of a numeric loop

You can use a slice of a numeric loop in a similar way, provided the loop is defined as expanded. In a numeric loop, the iteration ID is a numeric value, rather than a category name. For example, suppose you want to tabulate the gender of the first person in each household by the region. You would do this as follows:

Create a new table.

In the Variables pane, expand the person loop, and then expand the gender variable that is inside the person loop.

Select the first slice (1) and choose Add on the side of the table.

In the Variables pane, select the region variable and choose Add on the top of the table.

Choose the Generate table button:

Here is the table:

Notice that in this table, the label in the side axis is "1: Gender". When you use a slice of a grid or loop in a table, the full label is used instead of the normal label. This makes it clear which slice is being used, because, by default, the full label is the label prefixed by the iteration name.

When working in the hierarchical view the default generation level for a table is generally the lowest common ancestor level of all the filters and variables that are included in the table (including variables used in cell contents). However, when a table contains a grid slice at a lower level than any other variable included in the table, the default level will be the level above the grid slice. This is because, when tabulating a grid slice, it is more common to want to show the number of cases at the next level up rather than the number of responses at the grid level. However, you can choose to generate the table at the level of the grid slice if necessary.