Previous Page | Next Page

Functions and CALL Routines

LARGEST Function



Returns the kth largest non-missing value.
Category: Descriptive Statistics

Syntax
Arguments
Details
Examples
See Also

Syntax

LARGEST (k, value-1<, value-2 ...>)


Arguments

k

is a numeric constant, variable, or expression that specifies which value to return.

value

specifies the value of a numeric constant, variable, or expression to be processed.


Details

If k is missing, less than zero, or greater than the number of values, the result is a missing value and _ERROR_ is set to 1. Otherwise, if k is greater than the number of non-missing values, the result is a missing value but _ERROR_ is not set to 1.


Examples

The following SAS statements produce these results.

SAS Statements Results
k=1;
largest1=largest(k, 456, 789, .Q, 123);
put largest1;


789
k=2;
largest2=largest(k, 456, 789, .Q, 123);
put largest2;


456
k=3;
largest3=largest(k, 456, 789, .Q, 123);
put largest3;


123
k=4;
largest4=largest(k, 456, 789, .Q, 123);
put largest4;


.


See Also

Functions:

ORDINAL Function

PCTL Function

SMALLEST Function

Previous Page | Next Page | Top of Page