Sandy, what is an 'InfoResponse' example? I've never heard that term.
I do this all day long so to me its simple, but feel free to hate it:
Given some set of elements for which i want the median: say MEDIAN AGE for set of STUDENTS for each GRADE
i count the number of elements in each grade (NUM)
calculate the median marker MARKER=NUM/2
i list the elements in the relevant order, but don't use the list command (could, but dont), i just compute a RANK/I2=IF GRADE NE LAST GRADE THEN 1 ELSE LAST RANK + 1 ;
and then compare RANK to the MARKER.
here's some inelegant code
TABLE FILE STUDENTS
COUNT KID BY GRADE
PRINT KID
AND COMPUTE MARKER/I2=C1/2;
AND COMPUTE RANK/I2=IF GRADE NE LAST GRADE THEN 1 ELSE LAST RANK + 1;
AND COMPUTE temp/I1=IF RANK LT MARKER THEN 0 ELSE 1;
AND COMPUTE MEDIAN2/I1 0=IF GRADE NE LAST GRADE THEN temp ELSE
IF temp EQ 1 AND LAST temp EQ 0 THEN 1 ELSE 0;
AND COMPUTE MEDIANAGE/I4=AGE * MEDIAN2;
BY GRADE BY AGE
ON TABLE HOLD
END
TABLE FILE HOLD
SUM MEDIANAGE BY GRADE
END
you can tweak eg: decide if you want the median to be integer or double precision
and heres some data
KID GRADE AGE
KIDA 12 28
KIDB 12 17
KIDC 12 15
KIDD 12 16
KIDE 12 13
KIDF 12 34
KIDG 12 15
KIDH 12 12
KIDI 12 11
KIDJ 11 18
KIDK 11 17
KIDL 11 15
KIDM 11 16
KIDN 11 13
KIDO 11 14
KIDP 11 15
KIDQ 11 12
KIDR 11 11
KIDS 10 08
KIDT 10 07
KIDU 10 06
KIDV 10 05
KIDW 10 05
KIDX 10 05
KIDY 10 04
KIDZ 10 06
KIDa 10 07
KIDb 09 09
"Focus nation" i love that term. i see t-shirts, caps maybe...
| In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID |