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
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.