MEDIAN |
|
|
The MEDIAN field qualifier keyword causes a field to be reported together with its median average value.
Format
MEDIAN field {field.qualifiers} {NO.NULLS}
where
The MEDIAN field qualifier keyword is placed before the field name to which it applies and causes the query processor to report the value of the field for each record processed and also to report the median value (the midpoint value) at the end of the report. Used with breakpoints, the MEDIAN keyword will also report the median value of the field at each breakpoint.
If the field is defined as multivalued, the MEDIAN keyword operates on each value in turn.
The MEDIAN keyword operates only on numeric data. Non-numeric values are ignored except that the default behaviour is to treat null items as zero. The NO.NULLS keyword can be used to prevent null values being included in the calculation of the median value.
The median is defined as the middle value in a sorted list of all values, including repeated values, in the data being averaged. Where there are an even number of values, the median value is the average of the two values in the centre of the list.
Example
The sentence
LIST INVOICES MEDIAN VALUE CUSTOMER.NAME WITH NO AMT.PAID
would produce a display such as that below in which the median value of the VALUE field is included at the end of the report.
LIST INVOICES MEDIAN VALUE CUSTOMER.NAME WITH NO AMT.PAID Invoice ...Value Customer................... 74529 £1712.43 J McTavish 74273 £95.23 County Newspapers 28137 £26.20 J Higgins 63940 £141.00 R Bryant 74993 £9.29 Write Right Stationery ======== £95.23 5 records listed.
See also: |