Another approach using a DATETIME value and formats:
data WORK.WEATHER;
infile datalines truncover;
input date: DDMMYY10. time:TIME. temp:32.;
format date DDMMYY10. time TIME.;
dt = dhms(date,0,0,time);
format dt datetime18.;
datalines;
04/08/2018 7:00:00 18.461
04/08/2018 7:10:00 18.557
04/08/2018 7:20:00 18.675
04/08/2018 7:30:00 18.557
04/08/2018 7:40:00 18.461
04/08/2018 7:50:00 18.319
04/08/2018 8:00:00 18.39
04/08/2018 8:10:00 18.652
04/08/2018 8:20:00 19.246
04/08/2018 8:30:00 19.46
04/08/2018 8:40:00 19.793
04/08/2018 8:50:00 20.293
;
proc summary data=work.weather nway;
class dt;
format dt datetime10.;
var temp;
output out=work.weathermean (drop=_:) mean=;
run;
The output data set will have the first datetime value that rounds to an hour by using the datetime10 format. Change the format in other displays if you want to see it appear differently.
Or no added variable just a different format for the Time variable:
proc summary data=work.weather nway;
class date time;
format time time2.;
var temp;
output out=work.weathermean2 (drop=_:) mean=;
run;
Again, you can change the time variable format in other displays to get back to an hh:mm:ss appearance.
Either of these will also work if you have more or fewer records within the hour.
... View more