Returns the first non-missing value from a list of numeric arguments.
Category: Mathematical
COALESCE ( argument-1 < ... , argument-n >)
argument
is numeric. argument can be one of the following items:
a numeric value
a missing numeric value
the name of a numeric variable.
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.
The COALESCE function searches numeric arguments, whereas the COALESCEC function searches character arguments.
SAS Statements | Results |
---|---|
x = COALESCE(42, .); | 42 |
y = COALESCE(.A, .B, .C); | . |
z = COALESCE(., 7, ., ., 42); | 7 |
Function:
'COALESCEC Function' on page 442