BookmarkSubscribeRSS Feed
Johnsewell22
Calcite | Level 5

Hello,

I am trying to do a seasonal adjustment on a data set using procX12.  My error is as follows:

ERROR: Interval of date variable does not match INTERVAL=YEAR

The data set is an excel document that was properly imported (I know this because I have made a time series plot with the data).  

The year is a 4 digit year such as 1999.  

My code is as follows:

data seasonlogsun;
set logsunspots;
date=year;
format date Year;
run;

proc x12 data=seasonlogsun date=date interval=year;
var logsun;
x11;
ods select d11;
run;


Any help would be greatly appreciated.

3 REPLIES 3
solarflare
SAS Employee

Hello,

To clarify, are your date variable values before formatting are something like 01JAN1999, 01JAN2000, 01JAN2001, ... ?

 

In other words, does the date variable contain month and day information that is consistent and the interval of that data is one year? If you have monthly data then it would need to be accumulated yearly first using proc timedata.

 

A sample of the data before formatting would be helpful

Johnsewell22
Calcite | Level 5

The data are in 4 digit year format

1700

1701

1702

 

 

 

 

2004

solarflare
SAS Employee

I think the problem is that your input is not in a SAS date format in which the numeric value represents the number of days since Jan 1, 1960. So each successive year is being interpreted as the next day rather than the next year. 

 

To input the data correctly you need to use an informat.

 

Try using date = mdy (1,1,year); in your data step instead of date = year;

 

EDIT: In addition, to have the date display correctly, you will want to change your format statement to the following:

 

format date year4.;

sas-innovate-2024.png

 

Time is running out to save with the early bird rate. Register by Friday, March 1 for just $695 - $100 off the standard rate.

 

Check out the agenda and get ready for a jam-packed event featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events. 

 

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
  • 784 views
  • 0 likes
  • 2 in conversation