ORDINAL Function

Orders a list of values, and returns a value that is based on a position in the list.

Category: Descriptive Statistics
Returned data type: DOUBLE

Syntax

Arguments

position

specifies an integer that is less than or equal to the number of elements in the list of arguments.

Requirement position must be a positive number.
Data type DOUBLE

expression

specifies any valid expression that evaluates to a numeric value.

Requirement At least two arguments are required.
Data type DOUBLE
See <sql-expression>
FedSQL Expressions

Details

The ORDINAL function sorts the list and returns the argument in the list that is specified by position. Missing values are sorted low and are placed before any numeric values.

Comparisons

The ORDINAL function counts both null, missing, non-null, and nonmissing values, whereas the SMALLEST function counts only non-null and nonmissing values.

Example

The following statement illustrates the ORDINAL function:
Statement
Result
select ordinal(4,1,.,2,3,-4,5,6,7);
2