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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 697 views
  • 0 likes
  • 3 in conversation