Functions and CALL Routines 
Returns the kth largest nonmissing value.
Category: 
Descriptive Statistics

LARGEST (k, value1<, value2
...>)


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.
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 nonmissing values, the result is a missing
value but _ERROR_ is not set to 1.
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;

.

Copyright © 2011 by SAS Institute Inc., Cary, NC, USA. All rights reserved.