08-01-2013 11:03 AM
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?
08-02-2013 04:01 PM
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.
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;
proc timeseries data=sorted out=region;
id date interval=month accumulate=total;
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;
Hope this makes sense,
Message was edited by: Udo Sglavo