Exploring, modeling, predicting and reporting with SAS Visual Analytics and SAS Visual Statistics

n Week Moving Average

Reply
Contributor
Posts: 55

n Week Moving Average

[ Edited ]

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

SAS Super FREQ
Posts: 275

Re: n Week Moving Average

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

Contributor
Posts: 69

Re: n Week Moving Average

Can you try using the RelativePeriod in the New Aggregated column, see if its work for you.

Post a Question
Discussion Stats
  • 2 replies
  • 385 views
  • 0 likes
  • 3 in conversation