Date: Mon, 29 Apr 2002 07:11:10 +0400 Andrew "SPSSX(r) Discussion" Andrew Re: Summing three highest scores. text/plain; charset=us-ascii

Hi Paul,

If you are beginner in using SPSS - For future: Click menu "Transform" and click "Calculate" and calculate all you need. But now: 1) Click menu "File", click "New" and click "Syntax"; 2) Paste into new open window program text (called syntax); 3) But you must know about missing values - results may differ.

In any case use: I suggest three variants for calculating sum: 1) If data have missing values - sum not calculated (simple code); 2) If data have missing values - sum calculated and minus MIN value; 3) More complex code - "SUM = SUM ALL EXISTS EXAMS MINUS MINIMUM IF FOUR (ALL) EXAMS EXIST", you should be know about it!

Good luck, Andrew. 29 apr 2002

P.S. It is very fast and easy answer. There are many ways to do task more exactly and useful :)

/* START SYNTAX RESEARCHES OF EXAMS*/.

/* As example use missing value in last line */. /* (when run do not pay attention on remarks into spss output) */. /* but it is illustrated that will be if was no data...*/.

/* In process will be added next vars: s_easy, s3_mis, s3best, lowest, missexs */.

DATA LIST LIST /exam1(f1) exam2(f1) exam3(f1) exam4(f1). BEGIN DATA 5 5 5 5 4 5 5 5 4 4 4 5 4 4 4 4 2 3 4 5 , 2 3 4 END DATA. LIST.

/* Run all - result have different variables name */.

/* 1) FASTEST WAY FOR CALCULATING NEEDED SUM */. /* If data have missing values - sum not calculated (simple code) */. COMPUTE s_easy = exam1 + exam2 + exam3 + exam4 - MIN(exam1, exam2, exam3, exam4). VARIABLE LABELS s_easy 'Sum of 3 best exams minus lowest, If data have missing values - sum not calculated'.

/* 2) FASTEST WAY (2) FOR CALCULATING NEEDED SUM */. /* If data have missing values - sum calculated and minus MIN value; */. COMPUTE s3_mis = SUM(exam1 to exam4) - MIN(exam1 to exam4). VARIABLE LABELS s3_mis 'Sum of 3 (or 2 or 1) best exams minus lowest, Calculating in any cases'.

/* 3) SERIOUSLY WAY - USE WITH MISSING VALUES */. /* SUM = SUM EXISTS EXAMS AND MINUS MINIMUM IF FOUR (ALL) EXAMS EXIST */. COMPUTE s3best=0. COMPUTE lowest = MIN(exam1 to exam4). COMPUTE missexs=0. VARIABLE LABELS s3best 'SUM EXISTS EXAMS AND MINUS MINIMUM IF FOUR (ALL) EXAMS EXIST'. VARIABLE LABELS lowest 'Minimum exams value'. VARIABLE LABELS missexs 'Count of missing exams'. IF (MISSING(exam1)=1) missexs=missexs+1. IF (MISSING(exam2)=1) missexs=missexs+1. IF (MISSING(exam3)=1) missexs=missexs+1. IF (MISSING(exam4)=1) missexs=missexs+1. IF (MISSING(exam1)~=1) s3best=s3best+exam1. IF (MISSING(exam2)~=1) s3best=s3best+exam2. IF (MISSING(exam3)~=1) s3best=s3best+exam3. IF (MISSING(exam4)~=1) s3best=s3best+exam4. IF (missexs=0) s3best=s3best-lowest. EXECUTE. LIST.

/* END SYNTAX */.

RESULTS 5 5 5 5 15 15 15 5 0 4 5 5 5 15 15 15 4 0 4 4 4 5 13 13 13 4 0 4 4 4 4 12 12 12 4 0 2 3 4 5 12 12 12 2 0 , 2 3 4 , 7 9 2 1

> Original messege > > Date: Sun, 28 Apr 2002 00:48:44 -0400 > From: "Paul W. Jeffries" <pjeffrie@IC.SUNYSB.EDU> > Subject: Summing three highest scores.

> Dear List, In my SPSS file I have four exam scores for each student: exam1, exam2, > exam3, and exam4. I would like to create two new variables. One would be > a sum of the three highest scores, and the second variable would be the > lowest exam score for each student. How can I do this with syntax?

> All help is appreciated, > Paul W. Jeffries > Department of Psychology > SUNY--Stony Brook > Stony Brook NY 11794-2500

Back to: Top of message | Previous page | Main SPSSX-L page