Hi everyone,
I'm trying to make my question simple. My sales data have value of zero, meaning that there is no sales occurring at all, say, on Sundays. Therefore, the date is continuous since I do not need to forecast for Sunday sales. Is there any way to make forecast for such a time series data with the date gap?
If there is no sales on Sunday, filter Sunday's data out of the input, and use ID INTERVAL = WEEKDAY1W. The default seasonality for WEEKDAY1W is 6 (Monday to Saturday, the 1 in the interval stands for Sunday). If the data only consists of Monday to Friday's sales, use INTERVAL = WEEKDAY16W (1 for Sunday and 6 for Saturday).
Here is a sample code to use INTERVAL = WEEKDAY1W:
/*generate test data with sales from Monday to Saturday only*/
data test;
format date date7.;
starting_date = mdy(1,31,2016);
do i =0 to 700;
date = starting_date + i;
if mod(i,7) ne 0 then do;
sales = abs(100*rannor(12345));
output;
end;
end;
drop i starting_date;
run;
/*use WEEKDAY1W interval to handle 6 days a week data*/
proc hpf data = test seasonality = 6 out= _null_ outfor = outfor;
id date interval=weekday1w;
forecast sales;
run;
I'm not familiar with the SAS time series procs, but could you generate a consecutive series with a different variable representing 'time' so that it appears as if Monday follows Saturday. Complete the analysis and then move back to using dates. If it requires a date variable this won't work.
ie
Current_Var New_Var
Monday 1
Tuesday 2
Wednesday 3
Thursday 4
Friday 5
Saturday 6
Monday 7
Tuesday 8
If there is no sales on Sunday, filter Sunday's data out of the input, and use ID INTERVAL = WEEKDAY1W. The default seasonality for WEEKDAY1W is 6 (Monday to Saturday, the 1 in the interval stands for Sunday). If the data only consists of Monday to Friday's sales, use INTERVAL = WEEKDAY16W (1 for Sunday and 6 for Saturday).
Here is a sample code to use INTERVAL = WEEKDAY1W:
/*generate test data with sales from Monday to Saturday only*/
data test;
format date date7.;
starting_date = mdy(1,31,2016);
do i =0 to 700;
date = starting_date + i;
if mod(i,7) ne 0 then do;
sales = abs(100*rannor(12345));
output;
end;
end;
drop i starting_date;
run;
/*use WEEKDAY1W interval to handle 6 days a week data*/
proc hpf data = test seasonality = 6 out= _null_ outfor = outfor;
id date interval=weekday1w;
forecast sales;
run;
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 25. Read more here about why you should contribute and what is in it for you!
Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.
Find more tutorials on the SAS Users YouTube channel.