proc timeseries error

Reply
New Contributor
Posts: 2

proc timeseries error

I am trying to figure out how to use 'proc timeseries' but I keep getting a sorting error:

"Data set ET.BANKS is not sorted in ascending sequence"

I was under the impression that 'proc timeseries' would do the sorting for me, allowing me to skip the 'proc sort' step.

What does this error mean?

Super User
Posts: 11,343

Re: proc timeseries error

The documentation for 9.2 says if you use a by group data must be sorted first. Does that apply in this instance?

New Contributor
Posts: 2

Re: proc timeseries error

I don't know, I remember being specifically told you could skip the sort function. Perhaps I misunderstood.

SAS Employee
Posts: 416

Re: proc timeseries error

Hello -

When using PROC TIMESERIES with BY statements, you will have to sort your data first.

You won't have to sort your data by your time id if, though - as the ID statement of PROC TIMESERIES features a NOTSORTED option. In this case the procedure will sort the data for you.

Example:

SASHELP features a time series data set called PRICEDATA which contains information about certain products sold in in different regions in the US - each product is classified using 3 BY variables: regionname, productline, and productname.

If you would like to use TIMESERIES to determine total sales per region, you will have to use a BY variable and as such sort the data:

proc sort data=sashelp.pricedata out=sorted;

by regionname date;

run;

proc timeseries data=sorted out=region;

id date interval=month accumulate=total;

var sale;

by regionname;

run;


If you would like to use TIMESERIES to determine the total sales, there is no need for BY variables and no need to sort the data, but you can use the NOTSORTED option instead:

proc timeseries data=sashelp.pricedata out=total;

id date interval=month accumulate=total notsorted;

var sale;

run;

Hope this makes sense,

Udo

Message was edited by: Udo Sglavo

Ask a Question
Discussion stats
  • 3 replies
  • 264 views
  • 0 likes
  • 3 in conversation