BookmarkSubscribeRSS Feed
EPANG1
Fluorite | Level 6

Good afternoon,

 

I would like to calculate the average time for all records for the columns of  time_arrival and time_attend. However, one is display as character and one is display as time. How can I do this? Thanks

 

 

EPANG1_0-1636779432571.png

 

2 REPLIES 2
Reeza
Super User

Do the conversion for the one that's a character and subtract them.

 

Screen Shot 2021-11-12 at 10.04.42 PM.png

And results:

Screen Shot 2021-11-12 at 10.05.41 PM.png

Here's a great, but longer and in depth, reference for dates and times in SAS
https://communities.sas.com/t5/SAS-Communities-Library/Working-with-Dates-and-Times-in-SAS-Tutorial/...

 


@EPANG1 wrote:

Good afternoon,

 

I would like to calculate the average time for all records for the columns of  time_arrival and time_attend. However, one is display as character and one is display as time. How can I do this? Thanks

 

 

EPANG1_0-1636779432571.png

 


 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 891 views
  • 2 likes
  • 3 in conversation