Hey SAS Community,
I am new to SAS and would appreciate any advice on this topic.
For a university project, I need to calculate the expected sales value for the upcoming months after my dataset runs out. The dataset includes Total_amt, which contains the transaction values, and Tran_date, which specifies the dates of the transactions.
data TransactionsWithSasDate;
set Transactions;
Tran_date = mdy(Month, Day, Year);
format Tran_date date9.;
run;
proc sql;
create table MonthlySales as
select
intnx('Month', Tran_date, 0, 'Beginning') as Month format=date9.,
sum(Total_amt) as MonthlySalesValue
from TransactionsWithSasDate
group by calculated Month;
quit;
proc arima data=MonthlySales;
identify var=MonthlySalesValue(12);
estimate p=1 q=1;
forecast lead=12 id=Month interval=Month out=ForecastedSalesValue;
run;
proc sgplot data=ForecastedSalesValue;
series x=Month y=MonthlySalesValue / lineattrs=(color=blue) legendlabel="Actual";
series x=Month y=Forecast / lineattrs=(color=red) legendlabel="Forecast";
xaxis label='Month';
yaxis label='Monthly sales value';
title 'Monthly Sales Trend and Forecast';
run;
I double-checked my code, but I am not sure if it is correct because the output graph looks a little off.
Any advice on this topic would be highly appreciated!
Greetings, Johannes
@r0sner wrote:I double-checked my code, but I am not sure if it is correct because the output graph looks a little off.
Any advice on this topic would be highly appreciated!
Greetings, Johannes
Your first and last month (of actual sales -- blue line) make a good model and a good forecast almost impossible.
The last month is presumably incomplete (half-month sales?)
and the first month is either incomplete or still part of ramp-up during a product launch (new product introduction).
BR,
Koen
I moved this topic thread to "SAS Forecasting and Econometrics" - board.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!