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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

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
  • 2 replies
  • 575 views
  • 0 likes
  • 3 in conversation