I want to generate a new variable with mean values.

How do I generate a new variable with the "mean" or "median" values for the same subgroup of people? Later on I want to use the mean values for each subgroups as the y in an x-y graph. I KNOW how to generate a new variable based on "sum" function for at subgroup of people.

How do I generate a new variable with the "mean" or "median" values for the same subgroup of people? Later on I want to use the mean values for each subgroups as the y in an x-y graph. I KNOW how to generate a new variable based on "sum" function for at subgroup of people.

## Comment