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 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 16. 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
  • 3 replies
  • 1211 views
  • 0 likes
  • 2 in conversation