Example Showing Summary Statistics of a Numeric Variable in Cell Contents

Table generated at trip level

In the next table, the cell contents show not only the counts, but also the sum and mean summary statistics of the DaysAway numeric variable. This is a trip-level variable that stores the length of the trip in days. The sum values show the total number of days away and because the results are generated at the trip level, the mean values show the mean number of days per trip.

To create this table:

Expand the Trip grid within the Person loop, and add the purpose variable to the side.

Add the gender variable from the Person loop to the top.

Open the Table Properties tab (F4) and in the Cell Contents tab, add Sum to the list of items to include in cells.

Select Sum, and in the Based on field at the bottom of the tab, select person[..].trip[..].daysaway.

Add Mean to the list of items to include in cells, and base it on person[..].trip[..].daysaway as in the previous step.

Choose OK to apply the settings to the table, and generate the results.

Let's look at the three figures in the top left cell of the table. The first figure is 24, which corresponds with the base in the fourth table shown above, which tabulates two trip-level variables at the trip level. This figure shows the total number of overseas trips that were taken. The next figure is 320, which is the total number of days for all the trips. The final figure is the mean, which shows the average number of days per trip.

Table generated at person level

If we now generate results at the person level, the sum values will stay the same but the mean values will show the average number of days per person instead of per trip. Here is the table with results generated at the person level.

To create this table, use the same table specification and cell contents as for the previous table, but change the level to person.

Let's look at the three figures in the top left cell of this new table. The first figure is 12, which corresponds with the base in Table 7 in Examples Showing Results Generated at Different Levels, which tabulates the same variables at the person level. This figure shows the total number of people who have taken at least one overseas trip. The next figure is 320, which is the total number of days for all the trips. This figure is the same as when we generated the results at the trip level. However, the mean value is now 27, because it now shows the average number of days away per person instead of per trip.