<?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 Oracle Dates filter not working with a SAS to Oracle Passthrough in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Oracle-Dates-filter-not-working-with-a-SAS-to-Oracle-Passthrough/m-p/358169#M84140</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Good Morning SAS World,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am absolutely baffled by this error, as i have written something previously using the Date filters and it seemed to work fine, but with the below code i am getting back dates before the quoted range.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The purpose of this code is to pull transactions back with automated dates for the previous day only - however, it pull back everything that matches on the name logic regardless of the date&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I.e if today is&lt;/P&gt;&lt;P&gt;12MAY2017&lt;/P&gt;&lt;P&gt;i want everything from the 11th - which is what the macro dates provide , but the below code pull entries back from 2013 for example&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have also included a COMMENTED OUT TO_DATE - nrbquote date filter, is this any better, if so what is wrong with mine?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Much appreciated as always&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/*GET PREVIOUS WORKING DAY, THIS METHOD USES THE FRIDAY IF YESTERDAY WAS A WEEKEND*/&lt;BR /&gt;/*COLLECT TODAYS DATE (END_DATE) ASWELL SO THAT IF IT IS A WEEKEND THE TXNS PULLED WILL BE FOR THE WHOLE WEEKEND*/&lt;BR /&gt;DATA _NULL_;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PreviousBusinessday = intnx('weekday',today(),-1) ;&lt;BR /&gt;&amp;nbsp;END_DATE=intnx('Day', today(), 0,'beginning');&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;CALL SYMPUT ('PreviousBusinessday',""|| PUT(PreviousBusinessday,DATE9.));&lt;BR /&gt;CALL SYMPUT ('END_DATE',""|| PUT(END_DATE,DATE9.));&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;/P&gt;&lt;P&gt;/*ENTER PROD PATH USER AND PASSWORD DETAILS BELOW*/&lt;/P&gt;&lt;P&gt;CONNECT TO ORACLE (PATH="XXXX" USER=XXXX password="&amp;amp;XXXpw.");&lt;BR /&gt;CREATE TABLE US_txns AS select * from connection to oracle&lt;/P&gt;&lt;P&gt;(SELECT DISTINCT X.*&lt;BR /&gt;FROM DB_US.TXNS X&lt;BR /&gt;WHERE&lt;BR /&gt;/*SEARCH FOR NAMES */&lt;BR /&gt;UPPER(TRIM(X.ORIG_NM)) LIKE '%ABC LIMITED%' OR&lt;BR /&gt;UPPER(TRIM(X.BENEF_NM)) LIKE '%ABC LIMITED%'&lt;/P&gt;&lt;P&gt;/* %str(%') required when using macro in Oracle as it does not accept double quotes. All strings and dates need to be wrapped in single quotes. */&lt;BR /&gt;AND X.TRXN_EXCTN_DT &amp;gt;= %str(%')&amp;amp;PreviousBusinessday.%str(%')&lt;BR /&gt;AND X.TRXN_EXCTN_DT &amp;lt; %str(%')&amp;amp;END_DATE.%str(%')&lt;/P&gt;&lt;P&gt;/*&amp;gt;= TO_DATE(%nrbquote(')&amp;amp;PreviousBusinessday%nrbquote('), 'YYYYMMDD')*/&lt;/P&gt;&lt;P&gt;);&lt;BR /&gt;DISCONNECT FROM ORACLE;&lt;BR /&gt;QUIT;&lt;/P&gt;</description>
    <pubDate>Fri, 12 May 2017 08:04:23 GMT</pubDate>
    <dc:creator>MR_E</dc:creator>
    <dc:date>2017-05-12T08:04:23Z</dc:date>
    <item>
      <title>Oracle Dates filter not working with a SAS to Oracle Passthrough</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Oracle-Dates-filter-not-working-with-a-SAS-to-Oracle-Passthrough/m-p/358169#M84140</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Good Morning SAS World,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am absolutely baffled by this error, as i have written something previously using the Date filters and it seemed to work fine, but with the below code i am getting back dates before the quoted range.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The purpose of this code is to pull transactions back with automated dates for the previous day only - however, it pull back everything that matches on the name logic regardless of the date&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I.e if today is&lt;/P&gt;&lt;P&gt;12MAY2017&lt;/P&gt;&lt;P&gt;i want everything from the 11th - which is what the macro dates provide , but the below code pull entries back from 2013 for example&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have also included a COMMENTED OUT TO_DATE - nrbquote date filter, is this any better, if so what is wrong with mine?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Much appreciated as always&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/*GET PREVIOUS WORKING DAY, THIS METHOD USES THE FRIDAY IF YESTERDAY WAS A WEEKEND*/&lt;BR /&gt;/*COLLECT TODAYS DATE (END_DATE) ASWELL SO THAT IF IT IS A WEEKEND THE TXNS PULLED WILL BE FOR THE WHOLE WEEKEND*/&lt;BR /&gt;DATA _NULL_;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PreviousBusinessday = intnx('weekday',today(),-1) ;&lt;BR /&gt;&amp;nbsp;END_DATE=intnx('Day', today(), 0,'beginning');&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;CALL SYMPUT ('PreviousBusinessday',""|| PUT(PreviousBusinessday,DATE9.));&lt;BR /&gt;CALL SYMPUT ('END_DATE',""|| PUT(END_DATE,DATE9.));&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;/P&gt;&lt;P&gt;/*ENTER PROD PATH USER AND PASSWORD DETAILS BELOW*/&lt;/P&gt;&lt;P&gt;CONNECT TO ORACLE (PATH="XXXX" USER=XXXX password="&amp;amp;XXXpw.");&lt;BR /&gt;CREATE TABLE US_txns AS select * from connection to oracle&lt;/P&gt;&lt;P&gt;(SELECT DISTINCT X.*&lt;BR /&gt;FROM DB_US.TXNS X&lt;BR /&gt;WHERE&lt;BR /&gt;/*SEARCH FOR NAMES */&lt;BR /&gt;UPPER(TRIM(X.ORIG_NM)) LIKE '%ABC LIMITED%' OR&lt;BR /&gt;UPPER(TRIM(X.BENEF_NM)) LIKE '%ABC LIMITED%'&lt;/P&gt;&lt;P&gt;/* %str(%') required when using macro in Oracle as it does not accept double quotes. All strings and dates need to be wrapped in single quotes. */&lt;BR /&gt;AND X.TRXN_EXCTN_DT &amp;gt;= %str(%')&amp;amp;PreviousBusinessday.%str(%')&lt;BR /&gt;AND X.TRXN_EXCTN_DT &amp;lt; %str(%')&amp;amp;END_DATE.%str(%')&lt;/P&gt;&lt;P&gt;/*&amp;gt;= TO_DATE(%nrbquote(')&amp;amp;PreviousBusinessday%nrbquote('), 'YYYYMMDD')*/&lt;/P&gt;&lt;P&gt;);&lt;BR /&gt;DISCONNECT FROM ORACLE;&lt;BR /&gt;QUIT;&lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2017 08:04:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Oracle-Dates-filter-not-working-with-a-SAS-to-Oracle-Passthrough/m-p/358169#M84140</guid>
      <dc:creator>MR_E</dc:creator>
      <dc:date>2017-05-12T08:04:23Z</dc:date>
    </item>
    <item>
      <title>Re: Oracle Dates filter not working with a SAS to Oracle Passthrough</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Oracle-Dates-filter-not-working-with-a-SAS-to-Oracle-Passthrough/m-p/358176#M84142</link>
      <description>&lt;P&gt;Maybe your ANDs and OR are getting confused. I would try this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;WHERE
/*SEARCH FOR NAMES */
(UPPER(TRIM(X.ORIG_NM)) LIKE '%ABC LIMITED%' OR
UPPER(TRIM(X.BENEF_NM)) LIKE '%ABC LIMITED%')
/* %str(%') required when using macro in Oracle as it does not accept double quotes. All strings and dates need to be wrapped in single quotes. */
AND X.TRXN_EXCTN_DT &amp;gt;= %str(%')&amp;amp;PreviousBusinessday.%str(%')
AND X.TRXN_EXCTN_DT &amp;lt; %str(%')&amp;amp;END_DATE.%str(%')
/*&amp;gt;= TO_DATE(%nrbquote(')&amp;amp;PreviousBusinessday%nrbquote('), 'YYYYMMDD')*/&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 12 May 2017 08:23:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Oracle-Dates-filter-not-working-with-a-SAS-to-Oracle-Passthrough/m-p/358176#M84142</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2017-05-12T08:23:32Z</dc:date>
    </item>
    <item>
      <title>Re: Oracle Dates filter not working with a SAS to Oracle Passthrough</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Oracle-Dates-filter-not-working-with-a-SAS-to-Oracle-Passthrough/m-p/358182#M84145</link>
      <description>&lt;P&gt;Hi SAS Kiwi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;typically, as i posted the issue i noticed the absence of the brackets!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Fixed it straight away and its fine!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the response anyway&lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2017 08:57:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Oracle-Dates-filter-not-working-with-a-SAS-to-Oracle-Passthrough/m-p/358182#M84145</guid>
      <dc:creator>MR_E</dc:creator>
      <dc:date>2017-05-12T08:57:04Z</dc:date>
    </item>
    <item>
      <title>Re: Oracle Dates filter not working with a SAS to Oracle Passthrough</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Oracle-Dates-filter-not-working-with-a-SAS-to-Oracle-Passthrough/m-p/358183#M84146</link>
      <description>&lt;P&gt;I guess that Oracle does not like the SAS date literals. Most RDBMS I know want date literals as "YYYY-MM-DD".&lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2017 08:57:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Oracle-Dates-filter-not-working-with-a-SAS-to-Oracle-Passthrough/m-p/358183#M84146</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-05-12T08:57:41Z</dc:date>
    </item>
  </channel>
</rss>

