# Calculating averages of one variable by another

#### Bakish

##### New Member
Hello.
To spare you the background, I'll jump straight into describing what I'm stuck on.
Im working with World Value Survey weave 1 trough 6, so everything is on individual level.
I need to calculate national averages of a few variables, to give nation-nested models something to compare to.

So there's one variable for the respondants nation, coded with seemingly random numers corresponding to a list of national names.
I need to calculate the nation average for a few indicators of trust and tolerance.
I'm currently Selecting Cases number by number, stoping to do a manual descriptive statistics and copying the new value into my new variable. Every iteration takes several minutes due to the steps involved.
Just on the fact on how labour-intensive this process is I must assume there is an automated way of doing it, but I cant find anything on the web and my teachers are at a loss.

Help me TalkStats-One, you're my only hope!

Last edited by a moderator:

#### Karabiner

##### TS Contributor
It is not clear to me whether you want to create nation-wise descriptive
statistics, or wheter you want to create new variables?

The first goal could be achieved by using procedure MEANS. Or by using
SPLIT FILE before running the procedures for your descriptive statistics.

If it's the second aim, then maybe you want to use AGGREGATE, with
nation as "break" variable.

With kind regards

Karabiner

#### Bakish

##### New Member
It was the second. Miraculously, you responded just as I finished the 348 532 cases by Select Cases > Descriptive Statistics which totaled about 5 hours and 40 minutes.
The Aggregate using nations as breaks took just about one hundred and twentieth of the time to compute then to copy paste the value from Excel to SPSS for a single nation.
You sir, have my regards!