Hi all, I want to convert StartTime and EndTime which are character variable to datetime variable so I can do calculation. Please see our they are structured in my data source.
For example, the first row, I want my calculation to say that customer started at 11:00 AM and ended 11:00 AM. You are welcome to offer me another option of getting my desire calculation without any conversion.
Thank you ahead.
You can convert these type of text strings using the ANYDTDTM informat. Unfortunately it will not read the milliseconds. In the code below two methods are shown, one using the ANYDTDTM informat, the other uses a combination of two informats for the date and time part and then combine the date and seconds together using the DHMS function.
Thank you, it was helpful.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.