WMEDn returns a weekly median from a specified variable, Cx, begining with the day of the week specified as n.
(For N=7, the week is Sunday through Saturday.)
SYNTAX:
WMEDn(Cx, optional Time Increment)
where :
n specifies the Week Definition, which determines the begining and end of the week.
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:
If there is an even number of values, this function averages the middle two.
The result of the function is stored on the last day of the defined week (n).
The result is stored based on target variables frequency:
EXAMPLE 1: Return the Weekly median from a variable
Source variable (70) is set to Daily and Target variable (141) is also set to Daily. Because both the Source and Target variables are the same (Daily), the time increment BYDAY will be used.
V141 = WMED7(C70)
Variable 141 will have the weekly median of variable 70 (Sunday - Saturday) stored on Saturday of each week (as defined by n = 7):
EXAMPLE 2: Return the Weekly median from an Hourly variable into a Daily Calculation.
Source variable (70) is set to Hourly and Target variable (141) is set to Daily.
V70 - Is a hourly parameter
V141 - Is a daily calculation
V141 = WMED7(C70,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.
Example with MDL Rules:
V = WMED7(C5261)
On calculated variables, it is possible to elect to cascade MDL rules or not. Below is an example of cascading MOST frequent MDL symbol, ALL MDL symbols, and NONE or no MDL symbols.
V9611 - Most Frequent MDL Symbol
V9612 - All MDL Symbols
V9613 - No MDL Symbols
The first seven (7) days listed (boxed in red) below would sort like this: