=========================================================================
Date: Tue, 25 Jul 2006 10:51:20 -0500
Reply-To: John Norton <jnorton@lumc.edu>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: John Norton <jnorton@lumc.edu>
Subject: Re: Finding the Lowest Value
Content-Type: text/plain; charset=US-ASCII
Hi List,
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.').
END IF.
END LOOP.
EXE.
!ENDDEFINE.
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.
Best,
John Norton
Biostatistician
Oncology Institute
Loyola University Medical Center
(708) 327-3095
jnorton@lumc.edu
"Absence of evidence
|