BookmarkSubscribeRSS Feed
dotman
Calcite | Level 5
Hi,

I am trying to convert SAS date (08JUN2009) to microsoft standard date the method I have used is as follows -

PolstDt+21916 as SysProdDte label='SysProdDte' format=8.,

Any help appreciated.

Thanks
2 REPLIES 2
Bill
Quartz | Level 8
My understanding is that ms needs a datetime field. This is what I've used.

In your case, I think you will have to add time 00:00:00 to the sas date and then go through the steps below. Hopefully this will get you started.

Asof=sasdate plus sastime as a SAS datetime value;**Build sas datetime value;
**Build microsoft date serial;
AS_Of=(int(asof/86400) + 21916) + ((asof-(int(asof/86400)*86400))/86400);
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
You may want to entertain the question: what is it that you are trying to achieve - as in the final result? Then consider this SAS DOC reference, with relevance to external date formats:

http://support.sas.com/documentation/cdl/en/acpcref/61891/HTML/default/a003079774.htm

So, if you have an alternate baseline where 0 represents some particular point in time (date or date/time), then my suggestion is that you decrement from SAS DATE (days since 1/1/1960) or DATETIME (seconds since 1/1/1960) back to your baseline DATE/DATETIME representation, using the quite-useful MDY and/or the DHMS functions -- let SAS do the calculations for you rather than attempting to handle the calculation, instead.

Scott Barry
SBBWorks, Inc.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 921 views
  • 0 likes
  • 3 in conversation