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.?
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.