COALESCE Function


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

Category: Mathematical

Syntax

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

Arguments

argument

  • is numeric. argument can be one of the following items:

    • a numeric value

    • a missing numeric value

    • the name of a numeric variable.

Details

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' on page 442




SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 704

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net