BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
stancemcgraw
Obsidian | Level 7

Hi all,

 

  My time of arrivals were in excel as '17:07' and there must have previously been some character code in the column, because when I imported to SAS it changed to $21. and looks like '.7139444444444' except it's now in character. Any ideas how to change it back to the original numeric 24-hr time? 

 

Data have;

arrival time

.73194444444

.14652777778

.34444444444

.3

data want;

arrival time

17:07

3:31

8:16

7:12

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

Excel stores time as fraction of a day. So just multiple by 24 hours.

data have;
  input arrival $20.;
cards;
.73194444444
.14652777778
.34444444444
.3
;

data want;
  set have;
  time = '24:00't * input(arrival,32.);
  format time tod5.;
run;

Results:

Obs    arrival          time

 1     .73194444444    17:34
 2     .14652777778    03:31
 3     .34444444444    08:16
 4     .3              07:12

View solution in original post

1 REPLY 1
Tom
Super User Tom
Super User

Excel stores time as fraction of a day. So just multiple by 24 hours.

data have;
  input arrival $20.;
cards;
.73194444444
.14652777778
.34444444444
.3
;

data want;
  set have;
  time = '24:00't * input(arrival,32.);
  format time tod5.;
run;

Results:

Obs    arrival          time

 1     .73194444444    17:34
 2     .14652777778    03:31
 3     .34444444444    08:16
 4     .3              07:12

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 1 reply
  • 796 views
  • 3 likes
  • 2 in conversation