<?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 Pulling records based on a range in Oracle pass through in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Pulling-records-based-on-a-range-in-Oracle-pass-through/m-p/616061#M180295</link>
    <description>&lt;P&gt;I have 2 tables with a large number of records (100k+).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table B is the base that i have extracted and need to join to table B.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have to pull invoices for records for the previous 3 months. Where i am getting lost is on how to account for pulling records for the previous year if the date i have is for Jan.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to pull records where bill month falls in the 3 months before the sus month. Meaning 3 records.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried this but get no records... and i realize that it won't help me if the Sus_month value is 1 . The months being from 1 - 12.&lt;/P&gt;&lt;P&gt;and I have no idea on how to account for cases where it will need to pull from 2018&lt;/P&gt;&lt;P&gt;&lt;FONT&gt;&lt;BR /&gt;PROC SQL;&lt;BR /&gt;&amp;nbsp;CONNECT TO ORACLE (USER=&amp;amp;NAME&amp;nbsp; PW=&amp;amp;PASS&amp;nbsp; PATH=EXAODIN);&lt;BR /&gt;&amp;nbsp;CREATE TABLE CHARGE AS&lt;BR /&gt;&amp;nbsp;&amp;nbsp;SELECT B.*,A.* FROM CONNECTION TO ORACLE&lt;BR /&gt;&amp;nbsp;&amp;nbsp;(SELECT ID,SUB,BILL_YEAR,BILL_MONTH&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;FROM&amp;nbsp; OS.CHARGE&lt;BR /&gt;&amp;nbsp; &amp;nbsp; ) A INNER JOIN TEST2 B&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ON B.ID= A.ID&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;WHERE&amp;nbsp; A.BILL_MONTH BETWEEN (B.SUS_MONTH -3) AND (B.SUS_MONTH -1)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;;&lt;BR /&gt;&amp;nbsp;DISCONNECT FROM ORACLE;&lt;BR /&gt;QUIT;&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 08 Jan 2020 21:00:15 GMT</pubDate>
    <dc:creator>TheNovice</dc:creator>
    <dc:date>2020-01-08T21:00:15Z</dc:date>
    <item>
      <title>Pulling records based on a range in Oracle pass through</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pulling-records-based-on-a-range-in-Oracle-pass-through/m-p/616061#M180295</link>
      <description>&lt;P&gt;I have 2 tables with a large number of records (100k+).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table B is the base that i have extracted and need to join to table B.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have to pull invoices for records for the previous 3 months. Where i am getting lost is on how to account for pulling records for the previous year if the date i have is for Jan.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to pull records where bill month falls in the 3 months before the sus month. Meaning 3 records.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried this but get no records... and i realize that it won't help me if the Sus_month value is 1 . The months being from 1 - 12.&lt;/P&gt;&lt;P&gt;and I have no idea on how to account for cases where it will need to pull from 2018&lt;/P&gt;&lt;P&gt;&lt;FONT&gt;&lt;BR /&gt;PROC SQL;&lt;BR /&gt;&amp;nbsp;CONNECT TO ORACLE (USER=&amp;amp;NAME&amp;nbsp; PW=&amp;amp;PASS&amp;nbsp; PATH=EXAODIN);&lt;BR /&gt;&amp;nbsp;CREATE TABLE CHARGE AS&lt;BR /&gt;&amp;nbsp;&amp;nbsp;SELECT B.*,A.* FROM CONNECTION TO ORACLE&lt;BR /&gt;&amp;nbsp;&amp;nbsp;(SELECT ID,SUB,BILL_YEAR,BILL_MONTH&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;FROM&amp;nbsp; OS.CHARGE&lt;BR /&gt;&amp;nbsp; &amp;nbsp; ) A INNER JOIN TEST2 B&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ON B.ID= A.ID&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;WHERE&amp;nbsp; A.BILL_MONTH BETWEEN (B.SUS_MONTH -3) AND (B.SUS_MONTH -1)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;;&lt;BR /&gt;&amp;nbsp;DISCONNECT FROM ORACLE;&lt;BR /&gt;QUIT;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jan 2020 21:00:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pulling-records-based-on-a-range-in-Oracle-pass-through/m-p/616061#M180295</guid>
      <dc:creator>TheNovice</dc:creator>
      <dc:date>2020-01-08T21:00:15Z</dc:date>
    </item>
    <item>
      <title>Re: Pulling records based on a range in Oracle pass through</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pulling-records-based-on-a-range-in-Oracle-pass-through/m-p/616063#M180297</link>
      <description>&lt;P&gt;It looks like you are tying to join the Oracle table OS.CHARGE to the SAS dataset WORK.TEST2.&lt;/P&gt;
&lt;P&gt;If OS.CHARGE is large then you will probably need to upload a copy of TEST2 into Oracle in order to prevent SAS from pulling ALL of OS.CHARGE over to SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are getting syntax errors then please show the lines from the SAS log.&amp;nbsp; Make sure to paste in the lines of text from the log (not a Polaroid of your screen) using the Insert Code button on the editor so that the formatting is preserved.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jan 2020 21:08:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pulling-records-based-on-a-range-in-Oracle-pass-through/m-p/616063#M180297</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-01-08T21:08:02Z</dc:date>
    </item>
  </channel>
</rss>

