BookmarkSubscribeRSS Feed
jmehul
Quartz | Level 8

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)

2 REPLIES 2
ballardw
Super User

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"? 

jmehul
Quartz | Level 8

 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;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

Tips for filtering data sources in SAS Visual Analytics

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.

Discussion stats
  • 2 replies
  • 662 views
  • 0 likes
  • 2 in conversation