We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

SAS PROC SQL Date - How do you get current date?

Medium Priority
5,612 Views
Last Modified: 2012-05-11
This is a simple question, but I cannot seem to find an answer....I want to populate the current date in SAS query that utilizes PROC SQL.  In the PROC SQL section I want to append the current date as the report date.  I have tried DATE() and TODAY(), but the results is today's date in the year 1951 instead of 2011.  What am I doing wrong?  
Comment
Watch Question

GetDate()
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
I used that function and I get an error:

ERROR: Function GETDATE could not be located.

I typed in  GetDate()  in the select part of the PROC SQL.  

Author

Commented:
radcaesar - you may be correct, but if so I will not able to change it, is there a way to add 60 years to the date?  
DateAdd

Author

Commented:
DateAdd, as with GetDate, both seems to be SQL only functions, they are not recognized in SAS even when using PROC SQL.

ERROR: Function DATEADD could not be located.
CERTIFIED EXPERT
Top Expert 2012

Commented:
Since you are obviously not using SQL Server you should request that the MS SQL Server and SQL Server 2005 be dropped as they do not apply.

Author

Commented:
The database date was the issue, I had to therefore look for SAS code to change the date, the other suggestions would have worked for SQL.  I came up with:

intnx('year',today(),60,'same')
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.