ARCHIVED: In SPSS, how can I create the mean of a variable as a new variable?

This content has been archived, and is no longer maintained by Indiana University. Information here may no longer be accurate, and links may no longer be available or reliable.

SPSS can use the mean of a variable as a variable only in a very inelegant manner. Following is an example:

DATA LIST FIXED  /student 1-3. 
BEGIN DATA
40
60
97
55
END DATA.

COMPUTE dummy=1. 
AGGREGATE OUTFILE=new
  /BREAK=dummy
  /NEW=mean(student).
 
MATCH FILES TABLE=new / FILE=*
  /BY dummy.
EXECUTE.

After the program has read the data, create a dummy variable. With AGGREGATE, you can calculate statistics across cases, and save the results in an SPSS system file. By using MATCH FILES (with TABLE and BY), you can join the original and new files, matched on the dummy variable.

If you have questions about using statistical and mathematical software at Indiana University, contact the UITS Research Applications and Deep Learning team.

This is document abkm in the Knowledge Base.
Last modified on 2018-01-18 08:56:01.

Contact us

For help or to comment, email the UITS Support Center.