Desktop productivity for business analysts and programmers

Hourly results from 15 minute interval data

Accepted Solution Solved
Reply
Contributor
Posts: 48
Accepted Solution

Hourly results from 15 minute interval data

I have data source that has 15 minute intervals which I would like to group by hour.

 

If I use the format EVENT_TM hour.; format it sums the 8:30 and 8:45 to the 9am calculation.

 

Data Work.Interval_Final;

Set Work.Final_Int;

format EVENT_TM hour.;

Run;

 

 

How do I get the time inetrvals to add :00 :15 :30 and :45 to the correct hour.

 

Sample data below (Apologies I can't convert the data to the right format for others to use)

 

EVENT_DTEVENT_TMCALLS_ANSWERED_CNTCALLS_ABANDONED_CNTTOTAL_ANSWER_TM
11/01/20178:00:00937144734966
11/01/20178:15:00425158639406
11/01/20178:30:00402110627846
11/01/20178:45:00363121516766
11/01/20179:00:00407100613785
11/01/20179:15:00456112629621
11/01/20179:30:00503129671057
11/01/20179:45:00472119608942
11/01/201710:00:00485136702004
11/01/201710:15:00510132747481
11/01/201710:30:00361134438537
11/01/201710:45:0035694451957
11/01/201711:00:00457121603397
11/01/201711:15:00592169885680
11/01/201711:30:00416117549181
11/01/201711:45:00409132569009
11/01/201712:00:00447128630113
11/01/201712:15:00485171733852
11/01/201712:30:00405118549902
11/01/201712:45:0032092

372392


Accepted Solutions
Solution
‎01-17-2017 07:19 PM
Grand Advisor
Posts: 17,332

Re: Hourly results from 15 minute interval data

Try the TIME2. format instead.

 

If you want it displayed as 8:00 you'll likely need either a custom format or to do a calculate and create a new variable to work with. 

View solution in original post


All Replies
Solution
‎01-17-2017 07:19 PM
Grand Advisor
Posts: 17,332

Re: Hourly results from 15 minute interval data

Try the TIME2. format instead.

 

If you want it displayed as 8:00 you'll likely need either a custom format or to do a calculate and create a new variable to work with. 

Grand Advisor
Posts: 10,210

Re: Hourly results from 15 minute interval data

If you have a SAS data set these instructions will allow you to create the code for a data step to replicate your data (or a subset for example) https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat...

 

Is your sample data what you have or what you want? It looks like the time is already as you requested so we would need to see how it starts.

 

You need to include what you want as an output as it is not clear what you are doing. You say "sums the 8:30 and 8:45 to the 9am calculation" but that would only happen if you sent the data to a proc like means, report or tabulate.

 

Do you have data at shorter intervals and you need to group it?

Maybe something like this:

data have;
   informat time time.;
   format time time.;
   input time;
   newtime = intnx('minute15',time,0,'B');
   format newtime time.;
datalines;
08:10:15
08:14:00
08:20:21
08:29:59
;
run;
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 201 views
  • 0 likes
  • 3 in conversation