The code in the early post was my first pass at identifying the interval. But just saying 5 min interval does not mean a lot once you look at complex data. What if there is only a 3 min interval before a large jump in time? Does that matter? The likely hood that every series is not exactly 5 minutes complicates things. I think the answer lies in the following code (I just dont have the time to get further with it). Hopefully someone else in the community may have some ideas / solutions. data eur_usd2; set eur_usd; start = 0; datetime = dhms(date,hour(time),minute(time),second(time)); avg = mean(bid,ask); if _N_ = 1 then do; start = 1; secsince = 0; lagavg = 0; addsec = 0; end; else do; secsince = datetime - lag1(datetime); lagavg = lag1(avg); end; if secsince > 300 or addsec>300 then do; start = 1; addsec = 0; sec1avg = avg; end; if start = 0 then do; addsec = addsec + secsince; end; retain addsec sec1avg; format datetime datetime16.; run; EJ
... View more