Dear Jodene,
Try this:
* copy the data to an auxiliary vector (in order to keep the original
values intact).
vector #aux (9).
do repe x = pop1 to exam2 /aux = #aux1 to #aux9.
- compute aux = x.
end repe.
* find & destroy the lowest value, two times.
loop #pass = 1 to 2.
- compute #auxmin = min(#aux1 to #aux9).
- loop #i = 1 to 9.
- do if ( #aux(#i) = #auxmin ).
- compute #aux(#i) = $sysmis.
- break.
- end if.
- end loop.
end loop.
compute mysum = sum(#aux1 to #aux9).
exe.
Greetings,
Jan
-----Original Message-----
From: SPSSX(r) Discussion [mailto:
[hidden email]] On Behalf Of
Jodene Fine
Sent: Wednesday, March 21, 2007 10:25 PM
To:
[hidden email]
Subject: remove 2 lowest from var list and sum
Dear All,
I'm afraid this will be a silly one, but because SPSS likes to order
across cases and not variables, I can't figure this one out.
I have several scores which exists as variables, one for each case:
pop1, pop2, pop3, pop4, pop5, pop6, pop7, exam1, exam2
I need to set up some code that will compute a sum across the variables,
DROPPING the two lowest popx scores prior to summing.
I can't figure out how to sort across variables instead of cases so that
I can drop out the two lowest. The only other thing I can think of is
to set up a loop to compare each popx indidivdually, storing the two
lowest in temporary variables that I can then subtract. Hmm, could there
even be a vector in my life soon?
Am I on the right track?
Thanks many,
Jodene