The concept of SAS numeric variables representing each of DATE and DATETIME values are very unique and different. You will want to read up on the topic in the SAS DOC. For example, the two SAS statements below assign each of a DATA and a DATETIME variable, and show both the formatted and SAS-internal values:
MYDATETIME = "&SYSDATE9:&SYSTIME"DT;
MYDATE = "&SYSDATE9"D;
PUT 'Seconds since 1/1/1960' / MYDATETIME= BEST. / MYDATETIME= DATETIME. //;
PUT 'Days since 1/1/1960' / MYDATE= BEST. / MYDATE= DATE. //;
I don't think you understand my problem. Notice the same code is submitted for the creation of the date value. In the case where there is an ORDER BY clause, the numeric value produces an error when displayed as date..
When I format it as datetime. it returns '21JAN09:00:00:00:00' indicating that it has in fact set the numeric to the datetime rather than date.
This does not happen when accessing local libraries, only when I am pulling data from ORACLE. Adding an extra processing step solves the problem, but when processing 10**6 plus records it slows things down.