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 ?
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;
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
@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)
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.