Current Date Proc SQL

Accepted Solution Solved
Reply
Super Contributor
Posts: 465
Accepted Solution

Current Date Proc SQL

When I create tables in oracle I use sysdate() to set add a time stamp column, however this errors in proc SQL.  How can I add the current date in proc sql?


Accepted Solutions
Solution
‎06-02-2016 09:47 AM
Super Contributor
Posts: 406

Re: Current Date Proc SQL

[ Edited ]

Hi @DavidPhillips2,

 

In general you can use the SAS datastep functions (there are exceptions!). For the current date you have today(). If you want the date and time in one use datetime().

 

proc sql;
   select name, datetime() format=datetime22. 
   from sashelp.class;
quit;

View solution in original post


All Replies
Solution
‎06-02-2016 09:47 AM
Super Contributor
Posts: 406

Re: Current Date Proc SQL

[ Edited ]

Hi @DavidPhillips2,

 

In general you can use the SAS datastep functions (there are exceptions!). For the current date you have today(). If you want the date and time in one use datetime().

 

proc sql;
   select name, datetime() format=datetime22. 
   from sashelp.class;
quit;
Super Contributor
Posts: 465

Re: Current Date Proc SQL

I knew I could use today in a datastep but was unaware I could use it in proc sql.  Thanks for the advice.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 937 views
  • 1 like
  • 2 in conversation