Wow, I needed this today. First I couldn't figure out why my applied datetime format produced ****. I knew it was a datetime value because a null turned into a 0 and then displayed as midnight January 1, 1970. Another friend clued me in that it was orders of magnitude too large to be a current datetime, so I figured it included milliseconds but not the decimal. So I divided by 1000. That worked and I got the month/day and hh:mm:ss I expected. I didn't realize my years were off until I ran a query to look for records between two dates and kept getting 0 records. Then I realized all my dates were off - by exactly ten years. When I googled 'SAS date off by 10 years', I saw the title of this blog post and BOOM - I realized I had forgotten to account for the different starting points. For my testing, I can get away with code that wouldn't be suitable for production. I commented exactly what the integers mean. I went from stamp/1000 to floor((stamp)/1000)+315619200-14400 format=dateampm20. as Date