CORRELATION
The CORRELATION function returns the coefficient of the correlation of a set of number pairs.
The schema is SYSIBM.
The argument values must each be the value of any built-in numeric data type.
If an argument is DECFLOAT(n), the result of the function is DECFLOAT(34). Otherwise, the result of the function is double precision floating-point. The result is between -1 and 1. The result can be null.
The function is applied to the set of (expression-1, expression-2) pairs derived from the argument values by the elimination of all pairs for which either expression-1 or expression-2 is null.
COVARIANCE(expression-1,expression-2)/
(STDDEV(expression-1)* STDDEV(expression-2))
The order in which the values are aggregated is undefined, but every intermediate result must be within the range of the result data type.
CORR can be specified as a synonym for CORRELATION.
SELECT CORRELATION(SALARY, BONUS) INTO :corrln
FROM DSN8A10.EMP WHERE WORKDEPT = 'A00';
:corrln
is set to approximately 9.99853953399538E-001.