BookmarkSubscribeRSS Feed
jaiganesh
Obsidian | Level 7

Hello,

 

 

SAS internal Date format for 5/1/2019 is 43586.

 

Could anybody suggest, How to convert 43586 back to 5/1/2019 after importing ?

 

 

3 REPLIES 3
PeterClemmensen
Tourmaline | Level 20

Simply apply an appropriate format. However, I fail to see how 43586 in any format can be 5/1/2019? 🙂

 

data test;
   date=43586;
   format date mmddyy10.;
run;
tsap
Pyrite | Level 9

Can you please provide some additional details/logic regarding the importing of this data? This is so that we can have a better understanding of what is taking place, which in turn will allow us to provide a better answer to your question.

 

Thanks

FreelanceReinh
Jade | Level 19

@jaiganesh wrote:

SAS internal Date format for 5/1/2019 is 43586.

Nope. This looks much more like an Excel date (i.e. number of days after 31 Dec 1899, but including the non-existent 29 Feb 1900 -- known bug in Excel -- hence the 43585 below):

%put %sysevalf('01MAY2019'd-'31DEC1899'd); /* result: 43585 */

So, you'd need to subtract the "magic" number 21916 (=Excel date for SAS date 0, i.e. '01JAN1960'd) to arrive at a SAS date value, e.g., 21670 for 1 May 2019. (Search for "21916" in this forum and you'll find related discussions, e.g., this: https://communities.sas.com/t5/SAS-Programming/IF-THEN-ELSE-for-date-format-check/td-p/298030)

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 3 replies
  • 648 views
  • 1 like
  • 4 in conversation