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 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of 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
  • 494 views
  • 3 likes
  • 2 in conversation