[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2011-04-27
8
Medium Priority
?
4,647 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?  
0
Comment
Question by:Reborn84
8 Comments
 
LVL 6

Expert Comment

by:cfEngineers
ID: 35475774
GetDate()
0
 
LVL 9

Accepted Solution

by:
radcaesar earned 150 total points
ID: 35475926
Check the date setup in ur DB server, It may be set to 1951
0
 

Author Comment

by:Reborn84
ID: 35475934
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.  
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

Author Comment

by:Reborn84
ID: 35475966
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?  
0
 
LVL 6

Expert Comment

by:cfEngineers
ID: 35476336
DateAdd
0
 

Author Comment

by:Reborn84
ID: 35476379
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.
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 35480639
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.
0
 

Author Closing Comment

by:Reborn84
ID: 35484795
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')
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, we’ll look at how to deploy ProxySQL.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question