Home : MVSTATZ
Q11238 - INFO: MVSTATZ

MVSTATZ returns the specified summary statistic, handling data qualifiers, for a list of variables.  Variables can be of different types (IE Calculated, Daily, Hourly,etc...).

SYNTAX:

MVSTATZ(“Stat”,Offset,Grouping, Decimal_Places, MDL_Rule, VarNum1, VarNum2,…VarNum99)

or    

MVSTATZ(“Stat”,Offset,Grouping, Decimal_Places, MDL_Rule, “Where Clause”)

Stat: The statistic in quotes (ie “AVG”) of the value to calculate. 

>
Stat Notes
Avg Average of values
Sum Total of values
Max Maximum value
Max_VarNum Returns the Variable Number of the variable that has the maximum value.
Min Minimum value
Min_VarNum Returns the Variable Number of the variable that has the minimum value.
First First value found by date
First_VarNum The variable number of the variable that is the first value found.
Last Last value found by date
Last_VarNum The variable number of the variable that is the last value found.
GMean1 Returns the Geometric Mean of the values (convert 0 (zeros) to 1)
GMean2 Returns the Geometric Mean of the values (Add one to all if zero found)
GMean3 Returns the Geometric Mean of the values (Ignore zeros)
NOS,Count Returns the count or number of values found
PERCxx Returns the value at the xx Percentile (i.e. PERC90).
PERAxx Returns the value at the xx Percentile (averages two closest values if exact match not found)
PERIxx Returns the value at the xx Percentile (interpolates two closest values if exact match not found).  NOTE: This is the technique the Excel Percentile function uses.
PERExx Returns the value at the xx Percentile (interpolates two closest values, excludes first and last value).  NOTE:  This is the technique the Excel PERCENTILE.EXC function uses.
PERJxx

Returns the value at the xx Percentile (interpolates two closest values if exact match not found).  NOTE:  Specified by Connecticut DPH and is slightly different Interpolation then PERI.  Example to calc the 90th percentile of 7 samples:

7 * 90/100 = 6.3
Find the difference between the 6th (1.73) and 7th (1.95) ranked values:
1.95 - 1.73 = 0.22
Multiple .3 (the fractional part of the 6.3 above) times the difference:
0.3 * .22 = 0.066
Add 0.066 to the 6th ranked result:
1.73 + 0.066 = 1.796

GroupOffset/StartDate: Used with the Grouping parameter to set the dates to calculate the stat for.  Sets the number of Groups (set by the Grouping Parameter) to be added to set the dates.  See examples below. If this field is a date string (i.e. "07/16/2004") or refers to a cell with a date in it, it is assumed to be the start date to calculate the stat for.

Grouping/EndDate: Used to set which dates to calculate the stat for.  If the Grouping is a date literal string (i.e. "07/16/2004") or refers to a cell with a date in it, it is assumed to be the end date to calculate the stat for. Common Groupings are:

"D" Days
“M” Monthly 
"R" Report Dates
Click here for available Grouping options

Decimal_Places: Sets the number of decimal places to be displayed. For variables with decimal places set to "Not Fixed" click here for additional formatting options.

MDL Rule Sets when to display the MDL symbol (<,>, ND) with the calculated statistic.  Valid settings are:

1 - Display MDL symbol if one of the values contains the MDL symbol
2 - Display MDL symbol if over half the values contains the MDL symbol.
3 - Display MDL symbol if all of the values contains the MDL symbol.
4 - Cascade all symbols

VarNum1..VarNum99: A comma separated list of variables that sets which variables to calculate from.

Where clause Instead of providing a list of variables, you can use an SQL Where clause against the VarDesc table to get the list of variables.  I.E. “Units = 'mg/L'” wound return all variables with Units set to mg/L. See Examples.

NOTES:

To locate this formula when designing a report, use Locate, Multivariable Group Summary

SEE ALSO:

MVSTATDATE, MVSTAT

EXAMPLES:

MVSTATZ("MIN",1,"M",2,1,4011,4041)   Returns the minimum value to 2 decimal places for the current month for variables 4011 and 4041.  If the minimum value has a data quailifer it will be reported.  For example, <0.25.

MVSTATZ("MAX",1,"M",1,1,"UNITS = 'mg/L'")  Returns the maximum value for the current month for all variables that have mg/L as units.If the maximum value has a data quailifer it will be reported.  For example, <2.4.

Download Example Template: Help_MVStat.ss3 (Click here for download instructions)

Related Articles
No Related Articles Available.

Article Attachments
No Attachments Available.

Related External Links
No Related Links Available.
Help us improve this article...
What did you think of this article?

poor 
1
2
3
4
5
6
7
8
9
10

 excellent
Tell us why you rated the content this way. (optional)
 
Approved Comments...
No user comments available for this article.
Created on 5/12/2008 6:10 PM.
Last Modified on 7/25/2019 3:47 PM.
Last Modified by Scott Dorner.
Article has been viewed 6497 times.
Rated 0 out of 10 based on 0 votes.
Print Article
Email Article