Home > Expression Operators > Array Operators > #RANK

#RANK

This operator returns the rank (in integers) of the values within an array, on and before a particular date.  #RANK is only used in Service and Salary transformation expressions. For example, if the highest weekly salary was needed from a participant’s weekly history of salaries, #RANK could be used determine which weekly salary was the highest.

Syntax:

a #RANK b

where:

a = a scalar date, a local assigned variable, an expression (e.g., (#ENDMTH #DODEC) #RANK #THIS), or blank.

b = a start & stop dated array, an effected dated array, #THIS, #DATE, or an array created by assignment.

When:  

b is an array field, then a #RANK b returns rank values as of the stop or effective dates of the array for dates prior to a.  A rank of "0" will be returned for dates that are after a, as well as for calculation dates not equal to the stop or effective dates of the array.

b is not an array field, then a #RANK b returns rank values as of the end of measurement periods for calculation dates prior to a.  A rank of "0" will be returned for dates that are not end of measurement periods and for dates that occur after a.

a is blank or not provided, decrement date is used. #RANK b returns ranks of values from b on and before the decrement date. The option to not specify a date is only available for single decrement calculations. If multiple decrements are used, an error will be returned.

Examples:

Suppose:

date of termination is 12/31/2011
the array “salary” has the following values:

 

Start date Stop date Value
1/1/2008 12/31/2008 $ 30,000
1/1/2009 12/31/2009 $ 40,000
1/1/2010 12/31/2010 $ 35,000
1/1/2011 12/31/2011 $ 37,000

 

Example 1:

12/31/2010 #RANK salary  

Start date Stop date Value 12/31/2010 #RANK salary
1/1/2008 12/31/2008 $ 30,000 3
1/1/2009 12/31/2009 $ 40,000 1
1/1/2010 12/31/2010 $ 35,000 2
1/1/2011 12/31/2011 $ 37,000 0

 

Example 2:

#RANK salary

Start date Stop date Value #RANK salary
1/1/2008 12/31/2008 $ 30,000 4
1/1/2009 12/31/2009 $ 40,000 1
1/1/2010 12/31/2010 $ 35,000 3
1/1/2011 12/31/2011 $ 37,000 2

 

Example 3:

7/15/2006 #RANK salary

Start date Stop date Value 7/15/2006 #RANK salary
1/1/2008 12/31/2008 $ 30,000 0
1/1/2009 12/31/2009 $ 40,000 0
1/1/2010 12/31/2010 $ 35,000 0
1/1/2011 12/31/2011 $ 37,000 0

 

Example 4:

The highest weekly salary is needed from a participant’s weekly history of salaries to produce a yearly amount for the benefit calculation. The transformation expression in the weekly salary definition can be written as:

a:= #RANK weekly_salaries &  ; The values in column “a” of this
 ; transformation expression are the
 ; rankings of all weekly salaries
#THIS * (a=1)  ; The result is unchanged the rank is 1.
 ; the result is zero (0) when the rank
 ; of the salary is not 1

The result provides a set of the highest weekly value and lots of zero (o) values. By using a custom final average salary operator that uses the weekly salary definition would yield the desired results. The yearly amount for the benefit calculation would be 1 #FAS_custom 99.