ORDINAL Function

Returns the kth smallest of the missing and nonmissing values.

Category: Descriptive Statistics

Syntax

Required Arguments

k

is a numeric constant, variable, or expression with an integer value that is less than or equal to the number of subsequent elements in the list of arguments.

argument

specifies a numeric constant, variable, or expression. At least two arguments are required. An argument can consist of a variable list, preceded by OF.

Details

The ORDINAL function returns the kth smallest value, either missing or nonmissing, among the second through the last arguments.

Comparisons

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

Example

The following SAS statement produces this result.
SAS Statement
Result
x1=ordinal(4,1,2,3,-4,5,6,7);
3