DATA Step, Macro, Functions and more

Date / Time Formatting Issue

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 15
Accepted Solution

Date / Time Formatting Issue

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 !

Attachment

Accepted Solutions
Solution
‎07-08-2017 02:11 PM
Super User
Posts: 17,868

Re: Date / Time Formatting Issue

Have you tried TIME.?

 

View solution in original post


All Replies
Super User
Posts: 17,868

Re: Date / Time Formatting Issue

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 !


 

 

Occasional Contributor
Posts: 15

Re: Date / Time Formatting Issue

which format to use to get results in hhh:mm:ss ?

Solution
‎07-08-2017 02:11 PM
Super User
Posts: 17,868

Re: Date / Time Formatting Issue

Have you tried TIME.?

 

Occasional Contributor
Posts: 15

Re: Date / Time Formatting Issue

TIME10. worked, Thank you
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 113 views
  • 0 likes
  • 2 in conversation