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

Avg sales one week before and after Christmas

Reply
Contributor
Posts: 25

Avg sales one week before and after Christmas

[ Edited ]

Hi All,

 

I want to analysis the Avg sales one week before and after Christmas of the stores.

I have a date, sales, and store columns 

How can I do so? 

 

I am using SAS VA 7.4 and Viya. 

 

Thanks 

(learner)

Super User
Posts: 13,868

Re: Avg sales one week before and after Christmas

I don't have access to or experience with Visual Analytics, however there are a few additional pieces of information you might supply to help someone else answer the question.

 

First thing is to verify that your dates are actual SAS date values and not character values that look like dates or numeric that look like some date values. A number of 20180604 is not a date value unless it is being displayed with something like the SAS yymmddn8 format.

 

Second is to clearly define what you mean by "week before Christmas". Do mean the 7 days Dec 18 to Dec 24 or "the Sunday to Saturday preceding Christmas" or possibly some other definition that might involve the days your store is open? And similar for the week after Christmas. Remember that New Years Eve is 6 days after Christmas and New Years Day is 7 days. Do those days count for the "week"? 

Contributor
Posts: 25

Re: Avg sales one week before and after Christmas

 Hi @ballardw,

 

Sure would like to clarify more on that.

So the dates are in SAS familiar format and not character or numerical values. I am using ddmmyyd10. format here. I just need to calculate the sales 7 days before and after a particular date(say any holiday).
So trying to figure out if there is a way to store the holiday date in a variable in SAS Visual Analytics 9.4 as a benchmark value for our calculations.

SAS Code example 

Christmas = holiday('christmas', year);

format christmas DDMMYYD10.;
lower_date=intnx('day', christmas , -7);
format lower_date DDMMYYD10.;
upper_date=intnx('day', christmas , 7);
format upper_date DDMMYYD10.;

if lower_date<=date <= christmas then
festive_flag=1;
if christmas<=date <= upper_date then
festive_flag=2;
end;
run;

Ask a Question
Discussion stats
  • 2 replies
  • 120 views
  • 0 likes
  • 2 in conversation