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
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
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
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!
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.
Ready to level-up your skills? Choose your own adventure.