# How to Calculate Mean by Group in SPSS (With Example)

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:

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.

From this table we can see:

• 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.