Forecasting using SAS Forecast Server, SAS/ETS, and more

Newbie question : proc esm

Accepted Solution Solved
Reply
Occasional Learner
Posts: 1
Accepted Solution

Newbie question : proc esm

Hi,

I'm new to this program.

try to use proc esm but got this error.

it's work fine with other data so I don't know why.

data TS.Tax;
	input Year Million;
	datalines;
2005  6955.97
2006  7208.05
2007  7316.21
2008  7651.33
2009  7746.77
2010  8980.54
2011  10249.16
2012  11944.38
2013  12603.92
2014  12436.56
2015  13962.79
;
proc esm data=TS.Tax 
outfor=TS.outTax outstat=TS.statTax
back=0 lead=5 print=all plot=all;
id year interval=year;
forecast Million;
run;

ERROR: Duplicate time interval found at observation number 2 in the data set TS.TAX, according
       to the INTERVAL=YEAR option and the ID variable values. The current ID is Year=2006 and
       the previous is Year=2005, which are within the same YEAR interval.
       Check that INTERVAL=YEAR is correct for this data set, and that the ID variable Year
       contains SAS date or datetime values that correctly identify the observations.

 

Untitled2.png

I would appreciate your help.

 

Thank you


Accepted Solutions
Solution
‎11-15-2016 02:09 AM
Super User
Posts: 19,815

Re: Newbie question : proc esm

[ Edited ]

Year isn't a SAS date or date time variable which is what's expected. 

 

From the documentation:  

 

The ID statement names a numeric variable that identifies observations in the input and output data sets. The ID variable’s values are assumed to be SAS date or datetime values. In addition, the ID statement specifies the (desired) frequency associated with the time series.

Convert 'year' into a SAS date and it will work. You can use MDY() function and set it to Jan 1 of each year.

 

Year_SAS = MDY(1,1, year);

Format year_sas year4.;

 

Then replace year with year_sas in your code.

View solution in original post


All Replies
Solution
‎11-15-2016 02:09 AM
Super User
Posts: 19,815

Re: Newbie question : proc esm

[ Edited ]

Year isn't a SAS date or date time variable which is what's expected. 

 

From the documentation:  

 

The ID statement names a numeric variable that identifies observations in the input and output data sets. The ID variable’s values are assumed to be SAS date or datetime values. In addition, the ID statement specifies the (desired) frequency associated with the time series.

Convert 'year' into a SAS date and it will work. You can use MDY() function and set it to Jan 1 of each year.

 

Year_SAS = MDY(1,1, year);

Format year_sas year4.;

 

Then replace year with year_sas in your code.

SAS Employee
Posts: 416

Re: Newbie question : proc esm

Hello -

Little known feature of ESM - from documentation: " If an ID statement is not specified, the observation number, with respect to the BY group, is used as the time ID.". With other words, this code will work too:

proc esm data=ts.Tax

outfor=ts.outTax outstat=ts.statTax

back=0 lead=5 print=all plot=all;

forecast Million / model=damptrend ;

run;

 

I took the liberty to change the default model (simple ESM) to a damp trend model, which seems to be more appropriate for your data.

 

Thanks,

Udo

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 247 views
  • 0 likes
  • 3 in conversation