6. Functions : Stat Library Functions : MODAL Function
 
Share this page                  
MODAL Function
The MODAL function provides a measure of central tendency that identifies the element or elements of a data set that repeats most frequently, and more frequently than another element of the data set. Unlike AVERAGE and MEDIAN, the MODAL function can be applied to non-numeric data. The following table shows how MODAL works on various data sets:
Data Set
AVERAGE
MEDIAN
MODAL
{1, 2, 3}
2
2
None
{1, 1}
1
1
None
{1,1,2}
1.333
1
1
{1,1,2,10}
3.5
1.5
1
{1, 1, 2, 2}
1.5
1.5
None
{1, 1, 2, 2, 3}
1.8
2
1 and 2
{'John', 'John', 'Mary'}
N/A
N/A
'John'
{'1-jan-2003','1-jan-2003',
'2-jan-2003'}
N/A
N/A
'1-jan-2003'
This function has the following syntax:
Array = modal(list = array  [, modecount = byref(integer)]
          [, ignorecase = integer]);
Arguments
Data Type
Description
list
Array of Object
List of any of the following data types: FloatObject, IntegerObject, MoneyObject, DecimalObject, DateObject, LongVcharObject, StringObject. All elements must be of the same type.
modecount
Integer
Returns the number of instances of the modal value or values in the data set.
ignorecase
Integer
Valid values are FALSE and TRUE. This parameter is ignored unless the data type is StringObject. If set to TRUE, comparisons are case-insensitive.
Default: FALSE
This function returns:
Array of Object—Array containing the modal element or elements of the list. The array must be of the same type as the array passed to MODAL.
Null—If list is NULL or empty