Calculating Median revise

Peter Bateman ppfb@hotmail.com
Tue, 03 Aug 2004 11:48:19 -0300


I realized that the previous code would not work because
the ACCESS statement would reset my defines from the usefile.
So this one is given to create littorals in the access statement.
Two pass QUIZ solution with executable FINAL FOOTING :
access file
sort on x
define x-count integer = 1
define half_1 = 0.5
report summary x x-count subtotal noreset
set subfile name xsub

Final Footing ' access *xsub link to record ( ' &
               half_1 subtotal initial 0.5 noreset &
                  ') of *xsub alias low & ' &
               skip 1 &
               '              link to record ( '&
               half_1 subtotal initial 1  noreset &
               ') of *xsub alias high & ' &
               skip 1

set report device disc name usefile
set page width 72 length 0
set nohead
set close
go ; this gives the values in sequence with a sequence number

use usefile
; assuming the first record is record 1

define median = ( x of low + x of high ) / 2
report median
set report limit 1
go

Regards,
Peter Bateman

_________________________________________________________________
Don't just Search. Find! http://search.sympatico.msn.ca/default.aspx The new 
MSN Search! Check it out!