Date: Tue, 25 Jul 2006 10:51:20 -0500
Reply-To: John Norton <firstname.lastname@example.org>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: John Norton <email@example.com>
Subject: Re: Finding the Lowest Value
Content-Type: text/plain; charset=US-ASCII
Last week I requested help with locating the lowest value across several variables. The heart of my solution below rests with comparing whether the value of measure(#i) = MIN(wbc1 TO wbc9). I use a loop such that when that argument is true, I record the iteration (the week) to the target variable. Placed within a macro, I can call the macro as many times as I have measurements.
DEFINE low_week (first = !CHAREND(';')/last = !CHAREND(':') /target = !CMDEND).
VECTOR measure = !first TO !last.
LOOP #i = 1 TO 9.
DO IF (measure(#i) = MIN(!first TO !last)).
!CONCAT('COMPUTE ',!target,' = #i.').
low_week first = WBC1; last = WBC9: target = wbc_lowest_week.
low_week first = gran1; last = gran9: target = gran_lowest_week.
My thanks to Gene Maguin for his suggested solutions from last week.
Loyola University Medical Center
"Absence of evidence