Previous Page | Next Page

Functions and CALL Routines

COALESCE Function



Returns the first non-missing value from a list of numeric arguments.
Category: Mathematical

Syntax
Arguments
Details
The Basics
Comparisons
Examples
See Also

Syntax

COALESCE(argument-1<..., argument-n>)

Arguments

argument

specifies a numeric constant, variable, or expression.


Details


The Basics

COALESCE accepts one or more numeric arguments. The COALESCE function checks the value of each argument in the order in which they are listed and returns the first non-missing value. If only one value is listed, then the COALESCE function returns the value of that argument. If all the values of all arguments are missing, then the COALESCE function returns a missing value.


Comparisons

The COALESCE function searches numeric arguments, whereas the COALESCEC function searches character arguments.


Examples

SAS Statements Results
x = COALESCE(42, .);
42
y = COALESCE(.A, .B, .C);
.
z = COALESCE(., 7, ., ., 42);
7


See Also

Function:

COALESCEC Function

Previous Page | Next Page | Top of Page