Home > FAQ > Data Manipulation > Editing Arrays > Drop salaries earned (reported) before 1/1/2000

Drop salaries earned (reported) before 1/1/2000

When you need to drop rows from an array, the approach is to set one the dates (effective, start or stop) in that row to zero (or 1/1/1900) because #ARRAY automatically drops any row with a zero date from the final array. In ProAdmin, salaries are recognized on their stop dates, so dropping salaries earned before 1/1/2000 means we want to exclude/drop salaries whose stop date is less than 1/1/2000 (or keep salaries whose stop date is greater than or equal to 1/1/2000).

B_DT:= #START Salary & ; start dates

E_DT:= #STOP  Salary & ; stop dates
V:=    #VALUE Salary & ; values (i.e., the reported salaries)

COND:= E_DT >= 1/1/2000 &
; A stop date is either before 1/1/2000 or it’s greater than or equal to
; 1/1/2000, so E_DT >= 1/1/2000 is either 0 (false) or 1 (true).


AdjE_DT:= E_DT * COND &
; For any stop date less than 1/1/2000, AdjE_DT is 0; otherwise,
; AdjE_DT contains a date greater than or equal to 1/1/2000.


11 #ARRAY(B_DT,AdjE_DT,V) ; create a start/stop array (start,stop,values)
; NOTE: #ARRAY drops any row with a ZERO start or stop date

 

Data in the Salary field and intermediate results of the expression:

Salary Expression
Start Stop Value B_DT E_DT V COND AdjE_DT
7/16/1998 12/31/1998 23150.68 7/16/1998 12/31/1998 23150.68 0 0
1/1/1999 12/31/1999 51500.00 1/1/1999 12/31/1999 51500.00 0 0
1/1/2000 12/31/2000 53045.00 1/1/2000 12/31/2000 53045.00 1 12/31/2000
1/1/2001 12/31/2001 54636.35 1/1/2001 12/31/2001 54636.35 1 12/31/2001
1/1/2002 12/31/2002 56275.44 1/1/2002 12/31/2002 56275.44 1 12/31/2002

 

Final result of the expression (after #ARRAY has been applied):

Salary
Start Stop Value
1/1/2000 12/31/2000 53045.00
1/1/2001 12/31/2001 54636.35
1/1/2002 12/31/2001 56275.44