Title: DATE() SAS Function returns wrongs values
Tags: sas
Question: I have the following simple code:
data today;
a = date();
put a= date.;
When I run the code, the output shows:
"a=09JAN93"
The current time should be 09/01/2014.
In SAS EG works perfectly, but in SAS BASE (Version 9.00) returns wrongs values...
Any idea? Thanks in advance!
Comment: It's a good idea, the date command on the terminal returns:
"The current date is: 09/01/2014"

Comment: Imposible... The client has that version and it's not possible to upgrade it for me... :(

Comment: TODAY() and DATE() functions returns 12062 unformatted value

Comment: The value for the yearcutoff is 1920. The default value I guess

Comment: Output:
09JAN2014 17:00 01/09/1993    09JAN1993:19:51:07
So... $sysdate9. works!!!

Comment: EG on a server vs Base on a desktop?  If so, on your desktop, what happens when you open `cmd` and type `date`?

Comment: Also, you actually have SAS 9.0?  I have actually never seen that in the wild.  Definitely upgrade to 9.1.3 at least if not something newer.  9.0 was not a good version.

Comment: What number does it output (unformatted)?  Is it the correct number (19732) or 09JAN1993's (12062)?

Comment: I'd also consider trying TODAY(), just in case DATE() has a bug that TODAY() does not have.

Comment: I can't replicate this on 9.2, 9.3, or 9.4.  It is either an issue with your installation, or an issue with SAS 9.0.  I recommend opening a track with SAS technical support (go [here](http://communities.sas.com) and start a thread).

Comment: And tell your client SAS 9.0 is not really a stable release, and they need to upgrade (it should be a free upgrade, usually).  SAS itself doesn't even claim to have 9.0 on their support site - they merge it into support for 9.1.3, as if it were released simultaneously.

Comment: Can you verify the value of the YEARCUTOFF system option?

Comment: Can you run this and post the answer?  `%put
&sysdate9
&systime
%sysfunc(date(),mmddyy10)
%sysfunc(datetime(),datetime23)

Comment: let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/44909/discussion-between-joe-and-gekon)

Comment: &sysdate9. is a different thing; it's set up by the system when you first start SAS.  It's normally not reset after startup - ie, if you leave this session going, it'll be still 09JAN2014 for a week.



{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 0, 'CommentCount': 15, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2014:00:01/09/14', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<sas>', 'Title': 'DATE() SAS Function returns wrongs values', 'ViewCount': 133, 'id': 21027262, 'user_AboutMe': None, 'user_AccountId': 1130188.0, 'user_DisplayName': 'gekon', 'user_Reputation': 29.0, 'user_Views': 20.0, 'user_id': 1116476.0}}