How do you calculate the mean by group in SPSS, with an example?

Calculating the mean by group in SPSS involves using the “Aggregate” function to group the data by a specific variable and then calculating the mean for each group. For example, if we have a dataset of student grades with a variable for their grade level, we can use the Aggregate function to group the grades by grade level and then calculate the mean for each grade level. This will show us the average grade for each grade level, allowing us to compare the performance of students in different grade levels.


Often you may want to calculate the mean value of one variable in SPSS, grouped by another variable.

The easiest way to do this is by using Analyze > Compare Means and Proportions > Means.

The following example shows how to do so in practice.

Example: How to Calculate Mean by Group in SPSS

Suppose we have the following dataset in SPSS that shows the exam scores received by various students in three different classes:

Suppose that we would like to calculate the mean exam score for each class.

To do so, click the Analyze tab, then click Compare Means and Proportions, then click Means:

In the new window that appears, drag the Exam_Score variable into the Dependent List panel and drag the Class variable into the panel directly below it:

Then click OK.

The following output will be generated:

SPSS calculate mean by group

The first table titled Case Processing Summary displays the total number of cases (or “observations”) used in the analysis.

We can see that a total of N = 15 cases were used.

The next table titled Report displays the mean exam score for each class.

  • The mean exam score for students in class A was 93.60.
  • The mean exam score for students in class B was 92.60.
  • The mean exam score for students in class C was 82.80.

We can also see that the overall mean for all 15 students was 89.67.

The table also displays the total number of observations in each class along with the standard deviation of exam scores for each class.

Additional Resources

The following tutorials explain how to perform other common tasks in SPSS:


How to Calculate the Median in SPSS

x