Hi Friends,
I want to sum the time. I am using the below query but not getting the accurate sum of Hours. Please see the attached CSV file.
proc sql;
create table z as
select sum(time) as sum format=tod10.
from totaltime;
quit;
Kindly help !
The issue is likely with the format, there's nothing else that could be modified in your code.
Have you tried other formats? Looking at TOD it doesn't seem like it would have more than 24 hours and I suspect that's the issue you're having.
proc sql;
create table test as
select sum(time)/(60*60) as num_hours
from have;
quit;
@AgentA wrote:
Hi Friends,
I want to sum the time. I am using the below query but not getting the accurate sum of Hours. Please see the attached CSV file.proc sql;
create table z as
select sum(time) as sum format=tod10.
from totaltime;
quit;
Kindly help !
which format to use to get results in hhh:mm:ss ?
Have you tried TIME.?
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.