DATA Step, Macro, Functions and more

how to convert numeric time to character hh:mm:ss format

Accepted Solution Solved
Reply
New Contributor
Posts: 3
Accepted Solution

how to convert numeric time to character hh:mm:ss format

 How do i convert numeric time which is in format best12. and length as 8 for ex- 45240 to character hh:mm:ss format?

Any clue please


Accepted Solutions
Solution
‎02-15-2018 07:32 AM
Super User
Super User
Posts: 9,866

Re: how to convert numeric time to character hh:mm:ss format

Posted in reply to hanskronie

Follow the basic SAS training.  Numerics can be "put" into text variables using given formats, so for instance:

char_value=put(number_value,tod8.);

View solution in original post


All Replies
Solution
‎02-15-2018 07:32 AM
Super User
Super User
Posts: 9,866

Re: how to convert numeric time to character hh:mm:ss format

Posted in reply to hanskronie

Follow the basic SAS training.  Numerics can be "put" into text variables using given formats, so for instance:

char_value=put(number_value,tod8.);
PROC Star
Posts: 1,410

Re: how to convert numeric time to character hh:mm:ss format

Posted in reply to hanskronie

Do like this

 

data test;
	format time best12.;
	time=45240;
	char_time=put(time,tod8.);
run;
☑ This topic is solved.

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

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