One option is convert your datetime/time value into the character representation. Take the below as an example:
data have;
input time :datetime.;
format time datetime.;
datalines;
01JAN2020:05:33:00
;
run;
data want;
set have;
new_time = put(timepart(time),tod5.);
drop time;
run;
proc export data=want
file='/folders/myfolders/test.xlsb'
dbms=xls
replace;
sheet="test";
run;
One option is convert your datetime/time value into the character representation. Take the below as an example:
data have;
input time :datetime.;
format time datetime.;
datalines;
01JAN2020:05:33:00
;
run;
data want;
set have;
new_time = put(timepart(time),tod5.);
drop time;
run;
proc export data=want
file='/folders/myfolders/test.xlsb'
dbms=xls
replace;
sheet="test";
run;
Excel does not have a time of day concept like SAS. So when you enter a time in excel it always stores it as that time of day on some day. You can change the display format in Excel to have it just show the time part however.
When opened excel and typed in 12:00 it stored 0.5 and set the display to show it as hours and minutes. But if you change the display format you can get it to show the year, month and day also. (And also discover why you shouldn't use Excel to store dates before March 1, 1900.)
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.