BookmarkSubscribeRSS Feed
prantsaga
Calcite | Level 5

I am struggling! Ive been working with SAS for a few weeks now, learning new stuff every day and it feels great. I'm stuck at the moment.

I have two columns of datetimes (format datetime16.) And I want to subtract the second column from the first to calculate the cycle time between both of them in hh:mm format (the cycle time range is very large... ie. ranging from zero minutes to 2000 hours or larger)

I can't for the life understand what the best method to do this. I have 275,000 rows of data.

1 REPLY 1
Kurt_Bremser
Super User

I moved your post to a new topic. Please do not attach questions to resolved topics.

 

Use a simple subtraction, and assign a suitable format:

diff = time2 - time1; /* results in the difference in seconds */
format diff time8.; /* displays in human-readable form */

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 125 views
  • 0 likes
  • 2 in conversation