<?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 Re: datepart and intnx in oracle pass through using proc sql in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/datepart-and-intnx-in-oracle-pass-through-using-proc-sql/m-p/415075#M101760</link>
    <description>&lt;P&gt;Post your entire log please &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, you need a comma between date and shop in the code below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;select  at_date,
           datepart(at_date) as date /* You need a comma here */
           shop
from   ABC.GYGYGYG
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 21 Nov 2017 08:39:11 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2017-11-21T08:39:11Z</dc:date>
    <item>
      <title>datepart and intnx in oracle pass through using proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/datepart-and-intnx-in-oracle-pass-through-using-proc-sql/m-p/415069#M101757</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;I have the following code throwing errors.Can you please help me with correct code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;connect to oracle&lt;/P&gt;&lt;P&gt;(DEFER=XXX PATH=XXXX AUTHDOMAIN="XXXXXXXX"&lt;/P&gt;&lt;P&gt;);&lt;/P&gt;&lt;P&gt;create table temp as&amp;nbsp;&lt;/P&gt;&lt;P&gt;select *&lt;/P&gt;&lt;P&gt;from connection to ORACLE&lt;/P&gt;&lt;P&gt;(&lt;/P&gt;&lt;P&gt;select&amp;nbsp; at_date,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;datepart(&lt;SPAN&gt;at_date&lt;/SPAN&gt;) as date&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;shop&lt;/P&gt;&lt;P&gt;from&amp;nbsp; &amp;nbsp;ABC.GYGYGYG&lt;/P&gt;&lt;P&gt;where&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; datepart(at_date)=intnx('month','today()',-1,'e')/*want to get last date of last month*/&lt;/P&gt;&lt;P&gt;);&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2017 08:24:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/datepart-and-intnx-in-oracle-pass-through-using-proc-sql/m-p/415069#M101757</guid>
      <dc:creator>SkandaPannu</dc:creator>
      <dc:date>2017-11-21T08:24:23Z</dc:date>
    </item>
    <item>
      <title>Re: datepart and intnx in oracle pass through using proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/datepart-and-intnx-in-oracle-pass-through-using-proc-sql/m-p/415070#M101758</link>
      <description>&lt;P&gt;Post your log, that makes it easier to see where your code fails..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But first off, the today() function in your INTNX function should not be in quotation marks &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2017 08:26:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/datepart-and-intnx-in-oracle-pass-through-using-proc-sql/m-p/415070#M101758</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-11-21T08:26:32Z</dc:date>
    </item>
    <item>
      <title>Re: datepart and intnx in oracle pass through using proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/datepart-and-intnx-in-oracle-pass-through-using-proc-sql/m-p/415073#M101759</link>
      <description>&lt;P&gt;ERROR: ORACLE prepare error: ORA-00923: FROM keyword not found where expected.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2017 08:34:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/datepart-and-intnx-in-oracle-pass-through-using-proc-sql/m-p/415073#M101759</guid>
      <dc:creator>SkandaPannu</dc:creator>
      <dc:date>2017-11-21T08:34:42Z</dc:date>
    </item>
    <item>
      <title>Re: datepart and intnx in oracle pass through using proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/datepart-and-intnx-in-oracle-pass-through-using-proc-sql/m-p/415075#M101760</link>
      <description>&lt;P&gt;Post your entire log please &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, you need a comma between date and shop in the code below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;select  at_date,
           datepart(at_date) as date /* You need a comma here */
           shop
from   ABC.GYGYGYG
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Nov 2017 08:39:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/datepart-and-intnx-in-oracle-pass-through-using-proc-sql/m-p/415075#M101760</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-11-21T08:39:11Z</dc:date>
    </item>
    <item>
      <title>Re: datepart and intnx in oracle pass through using proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/datepart-and-intnx-in-oracle-pass-through-using-proc-sql/m-p/415076#M101761</link>
      <description>&lt;P&gt;You "&lt;SPAN&gt;&lt;STRONG&gt;want to get last date of last month&lt;/STRONG&gt;" -&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;you can do it by&amp;nbsp;&lt;STRONG&gt;today() - day(today()).&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2017 08:41:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/datepart-and-intnx-in-oracle-pass-through-using-proc-sql/m-p/415076#M101761</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-11-21T08:41:22Z</dc:date>
    </item>
    <item>
      <title>Re: datepart and intnx in oracle pass through using proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/datepart-and-intnx-in-oracle-pass-through-using-proc-sql/m-p/415082#M101762</link>
      <description>&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;connect to oracle&lt;/P&gt;&lt;P&gt;(DEFER=XXX PATH=XXXX AUTHDOMAIN="XXXXXXXX"&lt;/P&gt;&lt;P&gt;);&lt;/P&gt;&lt;P&gt;create table temp as&amp;nbsp;&lt;/P&gt;&lt;P&gt;select *&lt;/P&gt;&lt;P&gt;from connection to ORACLE&lt;/P&gt;&lt;P&gt;(&lt;/P&gt;&lt;P&gt;select&amp;nbsp; at_date,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;shop,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;datepart(&lt;SPAN&gt;at_date&lt;/SPAN&gt;) as date&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;from&amp;nbsp; &amp;nbsp;ABC.GYGYGYG&lt;/P&gt;&lt;P&gt;where&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; datepart(at_date)=intnx('month',today(),-1,'e')&amp;nbsp; /*want to get last date of last month*/&lt;/P&gt;&lt;P&gt;);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;log:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: ORACLE prepare error: ORA-00923: FROM keyword not found where expected. SQL Statement: select at_date,shop,datepart(at_date) as date from&amp;nbsp;&lt;SPAN&gt;ABC.GYGYGYG&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;where&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; datepart(at_date)=intnx('month',today(),-1,'e')&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2017 08:50:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/datepart-and-intnx-in-oracle-pass-through-using-proc-sql/m-p/415082#M101762</guid>
      <dc:creator>SkandaPannu</dc:creator>
      <dc:date>2017-11-21T08:50:03Z</dc:date>
    </item>
    <item>
      <title>Re: datepart and intnx in oracle pass through using proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/datepart-and-intnx-in-oracle-pass-through-using-proc-sql/m-p/415084#M101764</link>
      <description>&lt;P&gt;same error sir .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Problem with FROM&amp;nbsp;&lt;/P&gt;&lt;P&gt;FROM keyword not found where expected&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2017 08:54:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/datepart-and-intnx-in-oracle-pass-through-using-proc-sql/m-p/415084#M101764</guid>
      <dc:creator>SkandaPannu</dc:creator>
      <dc:date>2017-11-21T08:54:38Z</dc:date>
    </item>
    <item>
      <title>Re: datepart and intnx in oracle pass through using proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/datepart-and-intnx-in-oracle-pass-through-using-proc-sql/m-p/415094#M101765</link>
      <description>&lt;P&gt;Corrected your code:&lt;/P&gt;
&lt;PRE&gt;proc sql;
  connect to oracle (DEFER=XXX PATH=XXXX AUTHDOMAIN="XXXXXXXX");
  create table temp as 
  select *
  from connection to ORACLE
  (select  at_date,
           datepart(at_date) as date,
           shop
   from   ABC.GYGYGYG
   where datepart(at_date)=intnx('month',today(),-1,'e'));
  disconnect from oracle;
quit;&lt;/PRE&gt;
&lt;P&gt;Note than I put a comma after the "as date" part which you had missing, and removed today() from quotes.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do note however, I doubt today() will work as that is a SAS function.&amp;nbsp; If your passing SQL through to the database, then you need to use SQL and functions appropriate to the SQL database, you would need to use SYSDATE or CURRENT_DATE according to the Oracle documents:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.oracle.com/cd/B28359_01/server.111/b28286/functions037.htm#SQLRF00628" target="_blank"&gt;https://docs.oracle.com/cd/B28359_01/server.111/b28286/functions037.htm#SQLRF00628&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Of course you could drop the where clause completely, return all the records and then filter it in a simple datastep afterwards.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2017 09:19:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/datepart-and-intnx-in-oracle-pass-through-using-proc-sql/m-p/415094#M101765</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-11-21T09:19:20Z</dc:date>
    </item>
    <item>
      <title>Re: datepart and intnx in oracle pass through using proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/datepart-and-intnx-in-oracle-pass-through-using-proc-sql/m-p/415103#M101768</link>
      <description>&lt;P&gt;this code is not throwing errors or not returning output&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2017 09:49:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/datepart-and-intnx-in-oracle-pass-through-using-proc-sql/m-p/415103#M101768</guid>
      <dc:creator>SkandaPannu</dc:creator>
      <dc:date>2017-11-21T09:49:17Z</dc:date>
    </item>
    <item>
      <title>Re: datepart and intnx in oracle pass through using proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/datepart-and-intnx-in-oracle-pass-through-using-proc-sql/m-p/415104#M101769</link>
      <description>&lt;P&gt;And I can see these through the magic of guesswork?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Post logs outputs showing errors, post the code used which generates those errors!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As I said, today() will not work in Oracle - it doesn't exist, you need to use&amp;nbsp;&lt;U&gt;&lt;STRONG&gt;Oracle specific SQL&lt;/STRONG&gt;&lt;/U&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2017 09:52:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/datepart-and-intnx-in-oracle-pass-through-using-proc-sql/m-p/415104#M101769</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-11-21T09:52:38Z</dc:date>
    </item>
    <item>
      <title>Re: datepart and intnx in oracle pass through using proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/datepart-and-intnx-in-oracle-pass-through-using-proc-sql/m-p/415106#M101770</link>
      <description>&lt;P&gt;should i use curent_date.&lt;/P&gt;&lt;P&gt;not returning errors or ourput&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2017 10:02:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/datepart-and-intnx-in-oracle-pass-through-using-proc-sql/m-p/415106#M101770</guid>
      <dc:creator>SkandaPannu</dc:creator>
      <dc:date>2017-11-21T10:02:20Z</dc:date>
    </item>
  </channel>
</rss>

