Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     MEDIAN determination

Read-Only Read-Only Topic
Go
Search
Notify
Tools
MEDIAN determination
 Login/Join
 
Guru
posted
Does somebody in the FOCUS nation have a simple way for computing a Median. The InfoResponse examples are very elaborate and not readily applicable to the fex we are developing.

TIA -
Sandy


Sandy Kadish
Dev: 8.2.04- PostgreSQL
Test: 8.2.04 - PostgreSQL
Prod: 8.2.04 - PostgreSQL
 
Posts: 238 | Location: Atlanta, GA/Rehovot, Israel | Registered: May 06, 2003Report This Post
Expert
posted Hide Post
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
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Guru
posted Hide Post
Thanks - I got it to work!


Sandy Kadish
Dev: 8.2.04- PostgreSQL
Test: 8.2.04 - PostgreSQL
Prod: 8.2.04 - PostgreSQL
 
Posts: 238 | Location: Atlanta, GA/Rehovot, Israel | Registered: May 06, 2003Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     MEDIAN determination

Copyright © 1996-2020 Information Builders