 Functions and CALL Routines

# LARGEST Function

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

## 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.

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.

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;```
```

.```

 Functions: Previous Page | Next Page | Top of Page