BookmarkSubscribeRSS Feed
parmis
Fluorite | Level 6

Hello,

 

I'm trying to forecast the number of X and Y for each ID monthly for the next two years.

I have 6 months of data, my numbers are pretty much flat.

I'm not sure what forecast technique I should be using.

Thanks for your help in advance.

 

DateIDXY
Jan-18A1104
Jan-18B1275
Jan-18C13522
Jan-18D13427
Jan-18F12427
Feb-18A1244
Feb-18B13320
Feb-18C107
Feb-18D12444
Feb-18F1034
Mar-18A14224
Mar-18B1672
Mar-18C1633
Mar-18D100
Mar-18F16324
Mar-18L1360
6 REPLIES 6
imvash
SAS Employee

Since you do not have a long history of data, I suggest to calculate forecast values using a simple method like moving average. You can use PROC ARIMA with the options: noint noest and method=CLS. See the documentation at:

http://support.sas.com/documentation/cdl/en/etsug/60372/HTML/default/viewer.htm#etsug_arima_sect017....

 

Assuming you have at least 6 months of data (since proc ARIMA needs at least 6 observations to perform identification step), you may use the following code:

 

data test;
   input date monyy7. ID$ X Y;
   format date monyy7.;
   datalines;
JAN2018 A1  10  4
JAN2018 B1  27  5
JAN2018 C1  35  22
JAN2018 D1  34  27
JAN2018 F1  24  27
FEB2018 A1  2   44
FEB2018 B1  33  20
FEB2018 C1  0   7
FEB2018 D1  24  44
FEB2018 F1  0   34
MAR2018 A1  42  24
MAR2018 B1  67  2
MAR2018 C1  6   33
MAR2018 D1  0   0
MAR2018 F1  63  24
APR2018 A1  35  24
APR2018 B1  22  2
APR2018 C1  14   33
APR2018 D1  20  0
APR2018 F1  13  24
MAY2018 A1  21  24
MAY2018 B1  70  2
MAY2018 C1  60  33
MAY2018 D1  55   0
MAY2018 F1  55  24
JUN2018 A1  41  24
JUN2018 B1  64  2
JUN2018 C1  60  33
JUN2018 D1  10  0
JUN2018 F1  33  24
;

proc sort data = test out = test;
	by ID;
run;

proc arima data = test plots = none out = outX;
	by ID;
	identify var = X;
	estimate p = (1 2 3) ar = (0.3333 0.3333 0.3333) noint noest nostable method = CLS;
	forecast lead = 24;
run;
quit;

proc arima data = test plots = none out = outY;
	by ID;
	identify var = Y;
	estimate p = (1 2 3) ar = (0.3333 0.3333 0.3333) noint noest nostable method = CLS;
	forecast lead = 24;
run;
quit;
parmis
Fluorite | Level 6

Thanks for your reply. Do I have to write a separate code for each variable(X and Y)?

Also, when I run the query  I get the following error: Forecasting was not performed because estimation was not done

imvash
SAS Employee

Did you run my code and received the error?

 

As far as I can remember, you cannot specify several variables in proc arima. You need to do it separately for each variable.

parmis
Fluorite | Level 6

yes , I didn't make any changes

imvash
SAS Employee

I don't know why it doesn't work for you. I have it running on both SAS Studio and SAS 9.4.

ballardw
Super User

@parmis wrote:

Thanks for your reply. Do I have to write a separate code for each variable(X and Y)?

Also, when I run the query  I get the following error: Forecasting was not performed because estimation was not done


Go to the log, copy the log entry from the first data step using your test data set code through the end. Paste it into a code box opened with the {I} forum icon.

 

If you do not get the same message then there is something different in the data used.

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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
  • 6 replies
  • 1200 views
  • 0 likes
  • 3 in conversation