BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
luca87
Obsidian | Level 7

Hi,

I have this number 44824.689149 in sas table. If I put this it into an excel and format it in date time I get the following result is 20/09/2022 16:32:22.

 

How can I do this in sas?

I try with

 

data test;
a=put(44824.689149,datetime16.);
run;

but I get: 01jan60:12:27:05

 


Thanks,

Luca

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

Excel counts days from a different starting point.  Excel stores time of day as a fraction of a day. You can use the DHMS() function to days (including fractional days) into datetime.

data test;
  datetime=dhms('30DEC1899'd+44824.689149,0,0,0);
  format datetime datetime19.;
run;
317  data test;
318    datetime=dhms('30DEC1899'd+44824.689149,0,0,0);
319    format datetime datetime19.;
320    put datetime=;
321  run;

datetime=20SEP2022:16:32:22

View solution in original post

1 REPLY 1
Tom
Super User Tom
Super User

Excel counts days from a different starting point.  Excel stores time of day as a fraction of a day. You can use the DHMS() function to days (including fractional days) into datetime.

data test;
  datetime=dhms('30DEC1899'd+44824.689149,0,0,0);
  format datetime datetime19.;
run;
317  data test;
318    datetime=dhms('30DEC1899'd+44824.689149,0,0,0);
319    format datetime datetime19.;
320    put datetime=;
321  run;

datetime=20SEP2022:16:32:22

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 1 reply
  • 474 views
  • 0 likes
  • 2 in conversation