BookmarkSubscribeRSS Feed
r0sner
Calcite | Level 5

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;

 

Bildschirmfoto 2024-06-15 um 12.48.02.png

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

3 REPLIES 3
sbxkoenk
SAS Super FREQ

@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

sbxkoenk
SAS Super FREQ

I moved this topic thread to "SAS Forecasting and Econometrics" - board.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Multiple Linear Regression in SAS

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.

Discussion stats
  • 3 replies
  • 352 views
  • 0 likes
  • 3 in conversation