I am new to SAS and am taking a Business Intelligence course. I'm having some challenges with a predictive analytics assignment.
The assignment asks to predict the next 3 months of sales for small engines at various locations. I've explored the linear regression option but cannot figure out a way to show 3 months predicted sales. I looked at the time series forecasting and couldn't get it to show three months predicted sales. I think the answer lies in the time series option but haven't bee successful inputting things properly.
The data set has Month as the column that shows time. The other columns are locations. I can't find any tutorials on how to use the time series option in SAS and my text book only shows linear regression. I just need to know how to use the selections it offers.
Any suggestions would be helpful.
Hello @MN_8536 ,
Linear regression is not suitable for modelling time series data because the observations are not independent.
You need auto-regression or time series regression.
But time series regression (for example : ARIMA) is a bit more complicated than linear regression (only a bit).
I cannot explain that right here , right now , so it might be better to turn to exponential smoothing models.
ESM's are the most easy way to model and forecast timeseries.
You need SAS/ETS PROC ESM for that.
Look here for an example :
SAS® 9.4 and SAS® Viya® 3.5 Programming Documentation | SAS 9.4 / Viya 3.5
SAS/ETS User's Guide
The ESM Procedure
Example 15.1 Forecasting of Time Series Data
The time series didn't work. The month column is being read as seconds and the tab to change it doesn't drop down and is greyed out.
... the tab to change it ... ?
No idea what you are talking about.
What version of SAS are you using? SAS 9.4 M7 or SAS VIYA 3.5 or SAS VIYA 4 or ... ?
to find out.
If your variable is in seconds (and not days), it contains date-time values.
Extract the date, then apply the right format.
a = '01JUL2022:00:00:00'dt;
b = datepart(a);
put b= monyy7.;
If I understand correctly, you are using SAS Studio Tasks, correct? You need to look at the forecasting and time series tasks. See this short video for an intro:
Yes, I watched those. For some reason, it just wouldn't work with the data. Month was still be read as days even though I prepared it as date. There was also the issue of choosing a dependent variable when I have 6 locations to forecast all together. The data set has month and the locations and nothing else. I hope to learn how to do this in my upcoming Predictive Analytics course.
Thank you all for your input.
In order to make forecast on a time series, you need to first decide what model you want to use to obtain the forecast. Depending on which model you want to use, you can use different tasks in SAS Studio to obtain the forecast. For example, under Econometrics task-->Univariate Time Series Analysis, you can run ARIMA, ARIMAX, unobserved components model, or regression with autocorrelated errors to obtain the forecast. Under Forecasting task-->Modeling and Forecasting, you can obtain forecast based on ARIMA models, exponential smoothing models, or unobserved components models. For any of these models, you need to select the dependent variable name, which is the variable you want to obtain forecast for. In you case, you have 6 series(for 6 locations),if you want to consider each series individually and perhaps using different types of models using different tasks for different series(locations), then you can select the dependent variable name accordingly each time you work on a series. If you want to use the same type of models hence the same task for all 6 series at the same time, then you may want to restructure your data set such that the 6 series(locations) are stacked over one another with one variable name, say, 'sales', and with a location index variable that indicates which location the observation is taken, then in your task tab, select the 'sales' variable as dependent variable, and select the location index variable as the 'Group Analysis by' variable under 'Additional Roles' . This will perform the analysis separately for each series(location) but you do not need to select each series as dependent variable manually each time.
If you are not familiar with the task interfaces, you may also find it helpful to first experiment with a sample data set in sashelp library, e.g., sashelp.air, and experiment with simple models and obtain forecasts.
I hope this helps. If you have further questions using these tasks, please let me know.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.