BookmarkSubscribeRSS Feed
analytic_01
Calcite | Level 5

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!

2 REPLIES 2
ballardw
Super User

@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.

LinusH
Tourmaline | Level 20

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
Data never sleeps

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Tips for filtering data sources in SAS Visual Analytics

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.

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