Professional > Table scripting > Table specification syntax > Special elements > Restricting a mean using an expression
 
Restricting a mean using an expression
Sample Script File: SpecialElements.mrs
This example script is based on the Museum sample data set. See Running the sample table scripts for information on running the example scripts.
mean(visits, 'gender={Male}')
This example uses an expression on the mean element to specify the cases to use in the calculation of the value of the mean for the visits numeric variable. By adding the expression "gender={Male}", you restrict the calculation of the mean to include only those cases where the respondent is male. Apart from the mean element, you can create this type of expression for standard deviation, standard error, sample variance, minimum, and maximum elements. You must include a numeric variable when creating this type of expression, otherwise the expression is ignored and the special element (mean, standard deviation, standard error, or sample variance) is calculated from the assigned factors.
Here is a table that has this axis on the side:
See also
Special elements