Current Date Proc SQL

Accepted Solution Solved
Reply
Valued Guide
Posts: 617
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
Valued Guide
Posts: 533

Re: Current Date Proc SQL

[ Edited ]
Posted in reply to DavidPhillips2

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
Valued Guide
Posts: 533

Re: Current Date Proc SQL

[ Edited ]
Posted in reply to DavidPhillips2

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;
Valued Guide
Posts: 617

Re: Current Date Proc SQL

Posted in reply to jklaverstijn

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 and locked.

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

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