[S] Re: Reading dates from SAS data sets

Melvin Olson (melvin.olson.ch_gva01@serono.com)
Wed, 28 Oct 1998 10:19:09 +0100

I'm now posting the solution to my question from 10/16/98 about how to read
SAS dates into S-Plus. I received helpful replies from Thomas Richards,
Frank Harrell Jr., and Anona Thorne.

I now realize that S-Plus typically has no problems at all with SAS dates
using either the sas.get() function or Import Data from the File menu. The
problem I ran into is that our SAS data sets are created by connecting to
Oracle. Using this method, the default SAS format for dates seems to be
datetime16 which counts not days, but seconds, from Jan 1, 1960. I assumed
that if I created a second SAS data set and specified date7 as the format
for the dates, the problem would be solved. However, the format (and/or
informat) are NOT sufficient and it is necessary to divide the date
variable by (24*60*60) to get the number of days from Jan 1, 1960.

If you do not use the date7 format on the transformed date variable, you
can still specify the correct format in S-Plus after reading in the data
using the GUI. Of course, if you use the date7 format on the transformed
date variable, S-Plus automatically recognizes this as a date variable with
nothing more to specify.

Many thanks,
Melvin Olson

This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news