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-white.png

Missed SAS Innovate in Orlando?

Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.

 

Register now

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