Is there a way in VA to calculate a fix period moving average.
In the example below, it would be a 6 week moving average.
It wouldn't matter if the by group that hadn't observered 6 weeks of data yet were missing as below.
Category Brand Week Measure MA Cookies Brand1 1/3/2015 8583 * Cookies Brand1 1/10/2015 812 * Cookies Brand1 1/17/2015 827 * Cookies Brand1 1/24/2015 2323 * Cookies Brand1 1/31/2015 5256 * Cookies Brand1 2/7/2015 13712 5252 ((8583+812+827+2323+5256+13712)/6) Cookies Brand1 2/14/2015 14348 6213 ((812+827+2323+5256+13712+14348)/6) Cookies Brand1 2/21/2015 1654 6353 Cookies Brand2 1/3/2015 11074 * Cookies Brand2 1/10/2015 12299 * Cookies Brand2 1/17/2015 12689 * Cookies Brand2 1/24/2015 5140 * Cookies Brand2 1/31/2015 15695 * Cookies Brand2 2/7/2015 11048 11324 Cookies Brand2 2/14/2015 3898 10128 Cookies Brand2 2/21/2015 4959 8905
We are currently on VA 7.1
Hi Josh,
I don't think there is an easy way to do this within the VA designer interface.
I believe it should be possible to calculate the moving average as part of your data query using PROC SQL or PROC TIMESERIES.
Thanks,
Sam
Can you try using the RelativePeriod in the New Aggregated column, see if its work for you.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.
Find more tutorials on the SAS Users YouTube channel.