BookmarkSubscribeRSS Feed
Calcite | Level 5

Hi everyone

I have a csv file structured as

(date=xx/xx/xxxx, accuracy), var1=xx, var2=yy).

I want to look at autocorrelations of var1, var1*var2 etc at different time lags, e.g 1min, 2min, 10 min. There are several

observation at same date with same minute but at different milliseconds. For some dates or some time (xx:xx:xx),

there is no data also.

I converted date and time to total minutes passed since beginning of cutoff year. I used that variable as timestamp

and calculated mean, std etc for var1, var1*var2 using proc means. However I want to use timeseries procedure

to find out correlations.

SAS website says custom intervals cannot be used with timeseries but there might be another approach to solve this problem.

Do you know how to use minutes for intervals?

I can try to do it manually by defining new variables with different time lags but I need to do more complicated work for the dates/times where

there is no data



p.s:I started learning sas very recently, I appreciate any help/suggestions.

SAS Employee

Hello -

You should be able to take advantage of TIMESERIES without using any custom intervals.

Here is an example to illustrate what I'm talking about:

*sashelp.citiday points to a sample data set which features daily data for several measurements;

*work.minmonth will contain min values for each day per month and will written to the WORK library;

proc timeseries data=sashelp.citiday out=work.minmonth;

*in the ID statement you tell TIMESERIES which interval you want to aggregate to - in this case MONTH by specifying the interval option;

*note that month needs to be in a valid SAS date or datetime format;

*if you data is of datetime format you will have to add a DT, for example interval=DTMONTH;

*using the accumulate option you specify how you want to accumulate - in this case only the minimum values are used;

id date interval=month accumulate=min;

*the VAR statement points TIMEDATA to the column of your table you want to use;

var snydjcm;


Hope that helps.

Otherwise please share a sample of your data.





Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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
  • 1 reply
  • 2 in conversation