VAR_SAMP with Other Functions
VAR_SAMP can be combined with ordered analytical functions in a SELECT list, QUALIFY clause, or ORDER BY clause.
VAR_SAMP cannot be combined with aggregate functions within the same SELECT list, QUALIFY clause, or ORDER BY clause.
GROUP BY Affects VAR_SAMP Report Breaks
VAR_SAMP operates differently depending on whether there is a GROUP BY clause in the SELECT statement.
GROUP BY Clause | Result |
---|---|
Specified | VAR_SAMP is reported for each individual group. |
Omitted | VAR_SAMP is reported for all the rows in the sample. |
Measuring the Variance of a Population
If your data represents the entire population for the variable, then use the VAR_POP function.
As the sample size increases, the values for VAR_SAMP and VAR_POP approach the same number, but use the more conservative VAR_SAMP calculation unless you are sure your data constitutes the entire population for the variable.