Is it possible to create a time/date format so that 1.5 Hours can be converted into 1.30 equivalent (1 hour and 30 minutes) and use it on a graph so the aggregation (e.g. average) is correctly displayed?
Thanks!
@analytic_01 wrote:
Is it possible to create a time/date format so that 1.5 Hours can be converted into 1.30 equivalent (1 hour and 30 minutes) and use it on a graph so the aggregation (e.g. average) is correctly displayed?
Thanks!
You likely need to supply some example data where what ever you are aggregating by time is not displaying correctly. A format change of a time value from 1.5 hours to 1:30:00 minutes would generally not make a difference unless you have custom format creating groups that don't quite align with your need.
What is the current display format used for the value?
If you have a format like 8.1 then you likely do not actually have a date/ time value stored but something that only looks like a time value.
Since SAS time consists on seconds, just multiply your hour decimal value with 3600:
26 data _null_;
27 hours = 1.5;
28 SAStime = hours * 3600;
29 format SAStime time8.;
30 put SAStime;
31 run;
1:30:00
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.
See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.
Find more tutorials on the SAS Users YouTube channel.