Reputation: 341
I have a numeric variable where the numbers are of the form 924 1045 1742 etc. These are times.
I want to convert them to the time format 09:24:00.
I can't seem to find a way of doing this.
Upvotes: 0
Views: 2261
Reputation: 21264
Informat used is hhmmss and the format to see the time you want is time5:
data have;
informat time hhmmss4.;
format time time5.;
input time;
cards;
924
1045
1742
;
run;
IF the field is already a number in a dataset this would work:
data have;
input time;
cards;
924
1045
1742
;
run;
data want;
set have;
time_num=input(put(time, 4. -l), hhmmss4.);
format time_num time5.;
run;
proc print;run;
Upvotes: 1