Consider a List Table in VA 7.4 Designer. It has only two fields (Month, Median Patients). The desire is to calculate the cumulative median over the months. This cumulative median is labelled as "Median Patients". An example data with more descriptive steps is attached.
Please, take look. Note: It's easy to calculate the monthly Median Patients by just using the median function in VA 7.4 Designer (not the desire). The cumulative median is desired.
Thank you and have fun.`
Sample Data
-------------
Account ID Month #patients
---------- ------- ----------
1 Jan2017 5
2 Jan2017 3
3 Feb2017 7
4 Feb2017 6
5 Feb2017 2
6 Mar2017 4
7 Apr2017 1
8 Apr2017 10
9 Apr2017 9
10 Apr2017 3
Typical calculation in SAS VA 7.4
-----------------------------------
Monthly Median (Easy using median function)
-------------------------------------------
Month Median Patients
--------- ---------------
Jan2017 4 ( 5+3 ) /2
Feb2017 6 middle of ( 2,6,7 )
Mar2017 4
Apr2017 6 middle of ( 1,3,9,10 ) = (3+9)/2 = 6
Cumulative Monthly Median (Desired in SAS VA 7.4) Any idea how to calculate this assuming this is in a List Table with only two fields (Month and Median Patients)?
------------------------------------------------------------------------------------------------------------------------------------------------------------
Month Median Patients
-------- -----------------
Jan2017 4 ( 5+3 ) /2
Feb2017 5 middle of ( 2,3,5,6,7 ) = 5
Mar2017 5 middle of (2,3,4,5,6,7 ) = (4+5) /2 = 4.5(approx. 5 when rounded)
Apr2017 5 middle of(1,2,3,3,4,5,6,7,9,10) = (4+5) /2 = 4.5(approx. 5 when rounded)
To do this via SAS Code; I
Left Join
the segregated data to itself onmonth <= month
(to calculate the cumulative median for each month).Data:
Cumulative Median:
Output:
In VA Designer:
monthyear
and assign it same format as youMonth
field,drop-down
&List-Table
objects,Month
field to thedrop-down
, then go to roles tab and in the parameter box selectmonthyear
; which you just created,Month <= monthyear