MMAn returns a monthly moving average for n months for a specified variable. This function first calculates the monthly averages and then calculates the average of those averages. If a month contains no data, that month is ignored and the average is still calculated for the rest of the months.
SYNTAX:
MMAn(Cx, optional Time Increment)
where :
n is the number of months to include (must be greater than 1)
Cx is a conditional variable x
Time Increment Optional - specifies the source variables (Cx) Frequency when the Source Variable (CX) and target variable's (i.e. the variable being calculated) frequencies do not match.
NOTES:
The input variable must be specified as a Conditional Variable (use Cx instead of Vx)
The current month is included when performing the calculation
The result is stored based on target variables frequency:
EXAMPLE 1: Return the Monthly moving average from a variable
Source variable (70) is set to Daily and Target variable (109) is also set to Daily. Because both the Source and Target variables are the same (Daily), the time increment BYDAY will be used.
V109 = MMA12(C70)
Variable 109 will contain the 12 month moving average of variable 70:
EXAMPLE 2: Return the Monthly moving average from an Hourly variable into a Daily Calculation.
Source variable (70) is set to Hourly and Target variable (109) is set to Daily.
V70 - Is a hourly parameter
V109 - Is a daily calculation
V109 = MMA12(V70,BYHOUR)
Note: You MUST specify the Time Increment (BYHOUR) that matches the source variables frequency (IE the source variable V70 is Hourly, therefore we specify BYHOUR) in order for the function to return the correct value.
See: Working with Daily Detail Variables in Calculations.