Programming the statistical procedures from SAS

Divide data into intervals and run regression for each interval

Reply
New User
Posts: 1

Divide data into intervals and run regression for each interval

Hello,

 

I have to divide transaction data into ten minute intervals and then run a regression for the data of each interval. So for each time t, for example 18JUN2016, I have the respective transaction volume and price change. I was trying the following:

 

proc timeseries
data=datasets.&symbol.
    out=datasets.&symbol._10min;
    id time interval=MINUTE10.
    accumulate=NONE;
    
run;

 

 

Which didn't lead to a result. I wanted to, firstly, "cut off" the data for the first 10min interval to later run a regression.

 

I'm grateful for every hint!

 

Grand Advisor
Posts: 16,908

Re: Divide data into intervals and run regression for each interval

Assuming you have a time variable, look at the round function. 

 

Time is represented in seconds so ten minutes is 600

 

roumd(var,600) will group your data into 10 minute intervals. 

Respected Advisor
Posts: 4,606

Re: Divide data into intervals and run regression for each interval

18JUN2016 looks more like a SAS date than a SAS time or a SAS datetime, but, of course, it could be a SAS datetime value, formatted as a date. 

 

Assuming those times are SAS datetimes, you can assign them to the center of 10 minute bins with:

 

data myData10min;
set myData;
time10min = intnx("minute10.", time, 0, "MIDDLE");
run;

 

PG
Ask a Question
Discussion stats
  • 2 replies
  • 163 views
  • 1 like
  • 3 in conversation