BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Gil_
Quartz | Level 8
Hi I have table with start time. hh:mm when I export to excel using proc ecport to a xlsb file lt adds generic date and the correct time thanks for assistance for example 01/01/1990 05:33
1 ACCEPTED SOLUTION

Accepted Solutions
unison
Lapis Lazuli | Level 10

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;

Screenshot from 2020-01-25 22-00-47.png 

-unison

View solution in original post

4 REPLIES 4
unison
Lapis Lazuli | Level 10

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;

Screenshot from 2020-01-25 22-00-47.png 

-unison
Gil_
Quartz | Level 8
Thanks will try it
Tom
Super User Tom
Super User

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.)

image.png

Gil_
Quartz | Level 8
Thank you it works

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 2494 views
  • 0 likes
  • 3 in conversation