InterSystems MDX Reference STDDEVP Returns the population standard deviation of a given expression, across all elements of a set.
Returned Type
This function returns a number.
Syntax and Details
STDDEVP(set_expression, optional_numeric_expression)
Where:
• set_expression is an expression that evaluates to a set, typically a set of members or tuples.
• optional_numeric_expression is a numeric-valued expression that the function evaluates for each set element.
Typically, this expression has the form [MEASURES].[measure_name]
If you do not specify a numeric expression, the system uses the measure used by the current result cell.
The function evaluates the numeric value for each element of the set and returns the population standard deviation of those values.
Example
First, the following query shows two measure values for the members of the aged.decade level:
SELECT {MEASURES.[%COUNT],MEASURES.[encounter count]} ON 0,
birthd.decade.MEMBERS ON 1 FROM patients
Patient Count      Encounter Count
1 1910s                           80                5,359
2 1920s                          227               12,910
3 1930s                          567               33,211
4 1940s                          724               38,420
5 1950s                        1,079               46,883
6 1960s                        1,475               57,814
7 1970s                        1,549               49,794
8 1980s                        1,333               35,919
9 1990s                        1,426               29,219
10 2000s                        1,406               20,072
11 2010s                          134                1,346
Next, the following query shows the population standard deviations for these measures for the members of this level:
SELECT {MEASURES.[%COUNT],MEASURES.[encounter count]} ON 0,
STDDEVP(birthd.decade.MEMBERS) ON 1 FROM patients
Patient Count      Encounter Count
STDDEVP                        552.44            17,544.98
Here, each value is the population standard deviation of the values in a column in the preceding query. For example, the Patient Count value is the population standard deviation of the Patient Count values in the preceding query.
For another example, we use the second argument for STDDEVP:
SELECT STDDEVP(birthd.decade.MEMBERS, MEASURES.[%COUNT]) ON 0 FROM patients
STDDEVP
552.44
For additional, similar examples, see AVG.