# Correl - script function

Correl() returns the aggregated correlation coefficient for a series of coordinates represented by paired numbers in x-expression and y-expression iterated over a number of records as defined by a group by clause.

Syntax:

Correl(value1, value2)

Return data type: numeric

Arguments:

Correl arguments

| Argument | Description |
| --- | --- |
| value1, value2 | The expressions or fields containing the two sample sets for which the correlation coefficient is to be measured. |

Limitations:

Text values, NULL values and missing values in any or both pieces of a data-pair result in the entire data-pair being disregarded.

Examples and results:

Add the example script to your document and run it. Then add, at least, the fields listed in the results column to a sheet in your document to see the result.

Examples and results

| Example | Result |
| --- | --- |
| `Salary:`<br>`Load *, 1 as Grp;`<br>`LOAD  * inline [`<br>`"Employee name"\|Gender\|Age\|Salary`<br>`Aiden Charles\|Male\|20\|25000`<br>`Brenda Davies\|Male\|25\|32000`<br>`Charlotte Edberg\|Female\|45\|56000`<br>`Daroush Ferrara\|Male\|31\|29000`<br>`Eunice Goldblum\|Female\|31\|32000`<br>`Freddy Halvorsen\|Male\|25\|26000`<br>`Gauri Indu\|Female\|36\|46000`<br>`Harry Jones\|Male\|38\|40000`<br>`Ian Underwood\|Male\|40\|45000`<br>`Jackie Kingsley\|Female\|23\|28000`<br>`] (delimiter is '\|');` `Correl1:``LOAD Grp,``  Correl(Age,Salary) as Correl_Salary Resident Salary Group By Grp;<br>`` ` | `Correl_Salary` = 0.9270611 |