Skip to main content

Stdev - script function

Stdev() returns the standard deviation of the values given by the expression over a number of records as defined by a group by clause.

Syntax:  

Stdev([distinct] expr)

Return data type: numeric

Arguments:  

Arguments
Argument Description
expr The expression or field containing the data to be measured.
distinct If the word distinct occurs before the expression, all duplicates will be disregarded.

Examples and results:  

Add the example script to your app and run it. Then build a straight table with Type and MyStdev as dimensions.

Resulting data
Example Result

Table1:

crosstable LOAD recno() as ID, * inline [

Observation|Comparison

35|2

40|27

12|38

15|31

21|1

14|19

46|1

10|34

28|3

48|1

16|2

30|3

32|2

48|1

31|2

22|1

12|3

39|29

19|37

25|2 ] (delimiter is '|');

 

Stdev1:

LOAD Type,

Stdev(Value) as MyStdev

Resident Table1 Group By Type;

The results of the Stdev() calculation are:

  • Type is MyStdev
  • Comparison is 14.61245
  • Observation is 12.507997