<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to use today's date in where condition in proc sql? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-today-s-date-in-where-condition-in-proc-sql/m-p/567933#M159772</link>
    <description>&lt;P&gt;I'm trying to create a table using proc sql with date(in DATE9. format) as on of the column.&lt;/P&gt;&lt;P&gt;I'm trying to filter the data using where on the date column in the proc sql. I want to have today's date in the condition.&lt;/P&gt;&lt;P&gt;My code looks like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;BR /&gt;create table work.sheet as&lt;BR /&gt;select a, b, date&lt;/P&gt;&lt;P&gt;from library&lt;/P&gt;&lt;P&gt;where date&amp;gt;= '02-01-2018' and date &amp;lt;= today();&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The error message says;&lt;/P&gt;&lt;P&gt;SQL0440N No authorized routine named "TODAY" of type "FUNCTION" having compatible arguments was found. SQLSTATE=42884&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it works well when I use, where&amp;nbsp;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #333333; cursor: text; font-family: 'HelevticaNeue-light','Helvetica Neue',Helvetica,Arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;date&amp;gt;= '02-01-2018' and date &amp;lt;= '05-31-2019';&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone help me on this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
    <pubDate>Fri, 21 Jun 2019 14:47:54 GMT</pubDate>
    <dc:creator>kartheekm9</dc:creator>
    <dc:date>2019-06-21T14:47:54Z</dc:date>
    <item>
      <title>How to use today's date in where condition in proc sql?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-today-s-date-in-where-condition-in-proc-sql/m-p/567933#M159772</link>
      <description>&lt;P&gt;I'm trying to create a table using proc sql with date(in DATE9. format) as on of the column.&lt;/P&gt;&lt;P&gt;I'm trying to filter the data using where on the date column in the proc sql. I want to have today's date in the condition.&lt;/P&gt;&lt;P&gt;My code looks like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;BR /&gt;create table work.sheet as&lt;BR /&gt;select a, b, date&lt;/P&gt;&lt;P&gt;from library&lt;/P&gt;&lt;P&gt;where date&amp;gt;= '02-01-2018' and date &amp;lt;= today();&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The error message says;&lt;/P&gt;&lt;P&gt;SQL0440N No authorized routine named "TODAY" of type "FUNCTION" having compatible arguments was found. SQLSTATE=42884&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it works well when I use, where&amp;nbsp;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #333333; cursor: text; font-family: 'HelevticaNeue-light','Helvetica Neue',Helvetica,Arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;date&amp;gt;= '02-01-2018' and date &amp;lt;= '05-31-2019';&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone help me on this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2019 14:47:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-today-s-date-in-where-condition-in-proc-sql/m-p/567933#M159772</guid>
      <dc:creator>kartheekm9</dc:creator>
      <dc:date>2019-06-21T14:47:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to use today's date in where condition in proc sql?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-today-s-date-in-where-condition-in-proc-sql/m-p/567937#M159774</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where date&amp;gt;= '01FEB18'd and date &amp;lt;= "&amp;amp;sysdate"d;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 21 Jun 2019 14:52:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-today-s-date-in-where-condition-in-proc-sql/m-p/567937#M159774</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-06-21T14:52:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to use today's date in where condition in proc sql?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-today-s-date-in-where-condition-in-proc-sql/m-p/567947#M159780</link>
      <description>&lt;P&gt;Thank you Paige for the prompt reply. I'm still getting an error though:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SQL0104N An unexpected token "d" was found following "date &amp;lt;="21JUN19"". Expected tokens may include: "&amp;lt;update_source_no_row_query&amp;gt;". SQLSTATE=42601&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I removed the d as it was saying, and still got an error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SQL0206N "21JUN19" is not valid in the context where it is used. SQLSTATE=42703&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2019 15:12:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-today-s-date-in-where-condition-in-proc-sql/m-p/567947#M159780</guid>
      <dc:creator>kartheekm9</dc:creator>
      <dc:date>2019-06-21T15:12:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to use today's date in where condition in proc sql?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-today-s-date-in-where-condition-in-proc-sql/m-p/567951#M159782</link>
      <description>&lt;P&gt;The error message as it appears in your last message is meaningless to us unless we can see the code you are using. So ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Show us a portion of your data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Show us the full SASLOG, not just the error messages, and please paste the log into the window that appears when you click on the {i} icon; do not show us the SASLOG any other way.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2019 15:16:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-today-s-date-in-where-condition-in-proc-sql/m-p/567951#M159782</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-06-21T15:16:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to use today's date in where condition in proc sql?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-today-s-date-in-where-condition-in-proc-sql/m-p/567953#M159784</link>
      <description>&lt;P&gt;I guess this happens because of the way the implicit pass-through works. What happens if you use today() as the upper bound?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit: forget it. You already got a complaint for that in your first post.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2019 15:19:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-today-s-date-in-where-condition-in-proc-sql/m-p/567953#M159784</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-06-21T15:19:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to use today's date in where condition in proc sql?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-today-s-date-in-where-condition-in-proc-sql/m-p/567955#M159785</link>
      <description>No luck with that too,&lt;BR /&gt;&lt;BR /&gt;ERROR: CLI describe error: [IBM][CLI Driver][DB2/AIX64] SQL0440N No authorized routine named "TODAY" of type "FUNCTION" having&lt;BR /&gt;compatible arguments was found. SQLSTATE=42884</description>
      <pubDate>Fri, 21 Jun 2019 15:20:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-today-s-date-in-where-condition-in-proc-sql/m-p/567955#M159785</guid>
      <dc:creator>kartheekm9</dc:creator>
      <dc:date>2019-06-21T15:20:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to use today's date in where condition in proc sql?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-today-s-date-in-where-condition-in-proc-sql/m-p/567957#M159787</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/277712"&gt;@kartheekm9&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you Paige for the prompt reply. I'm still getting an error though:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SQL0104N An unexpected token "d" was found following "date &amp;lt;="21JUN19"". Expected tokens may include: "&amp;lt;update_source_no_row_query&amp;gt;". SQLSTATE=42601&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I removed the d as it was saying, and still got an error:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SQL0206N "21JUN19" is not valid in the context where it is used. SQLSTATE=42703&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;One suspects that you are connecting to an external DBMS and that the message is from the other system, MS SQL Server perhaps?&lt;/P&gt;
&lt;P&gt;If you are using Pass through SQL then your syntax needs to conform to the external system.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2019 15:20:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-today-s-date-in-where-condition-in-proc-sql/m-p/567957#M159787</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-06-21T15:20:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to use today's date in where condition in proc sql?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-today-s-date-in-where-condition-in-proc-sql/m-p/567958#M159788</link>
      <description>&lt;P&gt;Please post the complete log of the complete SQL; include any libname definitions you use to connect to DB/2.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2019 15:22:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-today-s-date-in-where-condition-in-proc-sql/m-p/567958#M159788</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-06-21T15:22:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to use today's date in where condition in proc sql?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-today-s-date-in-where-condition-in-proc-sql/m-p/567968#M159794</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please check this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;BR /&gt;create table work.sheet as&lt;BR /&gt;select a, b, date&lt;/P&gt;&lt;P&gt;from library&lt;/P&gt;&lt;P&gt;where date&amp;gt;= '02-01-2018'd and date &amp;lt;= today();&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It worked for me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Anushree&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2019 15:40:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-today-s-date-in-where-condition-in-proc-sql/m-p/567968#M159794</guid>
      <dc:creator>anushreebiotech</dc:creator>
      <dc:date>2019-06-21T15:40:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to use today's date in where condition in proc sql?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-today-s-date-in-where-condition-in-proc-sql/m-p/567976#M159799</link>
      <description>&lt;P&gt;Welcome to the world of dealing with dates. This link may help you in understanding what the hay today() is and how you can use it.&lt;/P&gt;
&lt;P&gt;&lt;FONT style="background-color: #ffffff;"&gt;&lt;A href="https://v8doc.sas.com/sashtml/lrcon/zenid-63.htm" target="_blank"&gt;https://v8doc.sas.com/sashtml/lrcon/zenid-63.htm&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT style="background-color: #ffffff;"&gt;You do have to put on your thinking cap when working with dates in any programming language.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2019 15:51:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-today-s-date-in-where-condition-in-proc-sql/m-p/567976#M159799</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2019-06-21T15:51:49Z</dc:date>
    </item>
  </channel>
</rss>

