DATA Step, Macro, Functions and more

How to read the time in format (example): hh:mm:ss

Accepted Solution Solved
Reply
Regular Contributor
Posts: 214
Accepted Solution

How to read the time in format (example): hh:mm:ss

Hi all,

 

Could you please advise how to read the time in the following format (example): 8:15:00 .

 

Thank you!


Accepted Solutions
Solution
‎11-21-2017 09:10 AM
Super User
Posts: 10,217

Re: How to read the time in format (example): hh:mm:ss

Posted in reply to DmytroYermak

Use the time8. informat. Assign the time8. or tod8. format to the variable.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code

View solution in original post


All Replies
Solution
‎11-21-2017 09:10 AM
Super User
Posts: 10,217

Re: How to read the time in format (example): hh:mm:ss

Posted in reply to DmytroYermak

Use the time8. informat. Assign the time8. or tod8. format to the variable.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Regular Contributor
Posts: 214

Re: How to read the time in format (example): hh:mm:ss

Posted in reply to KurtBremser

Thank you! Here it is the code:

strip(put(input(strip(PK_TIME),time8.),tod5.))
Super User
Posts: 10,217

Re: How to read the time in format (example): hh:mm:ss

Posted in reply to DmytroYermak

You can also use the time8. format for display and conversion to character; it's just that I like the leading zero of the tod. format more.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
☑ This topic is solved.

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

Discussion stats
  • 3 replies
  • 163 views
  • 0 likes
  • 2 in conversation