<?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: Proc SQL Filter between previous Business day and current date in the where clause in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Filter-between-previous-Business-day-and-current-date/m-p/512239#M137924</link>
    <description>&lt;P&gt;Thank you.&lt;BR /&gt;I used the below to get the desired result:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;intnx('WEEKDAY',today(),0,"b") and intnx('WEEKDAY',today(),-1,"b")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To get only the prior business day data.&lt;/P&gt;</description>
    <pubDate>Mon, 12 Nov 2018 15:57:52 GMT</pubDate>
    <dc:creator>phoenix31</dc:creator>
    <dc:date>2018-11-12T15:57:52Z</dc:date>
    <item>
      <title>Proc SQL Filter between previous Business day and current date in the where clause</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Filter-between-previous-Business-day-and-current-date/m-p/512212#M137919</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have an Oracle query which pulls in data from the previous Business day however I am trying to convert this to a SAS query (Proc SQL Statement) and need help converting previous day Business day (M-F) in SAS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Oracle code:&lt;/P&gt;&lt;P&gt;select * from tablename where columnname&amp;nbsp;&amp;nbsp;BETWEEN&amp;nbsp; decode(to_char(sysdate,'D'),2,trunc(sysdate-3),trunc(sysdate-1)) AND&amp;nbsp; trunc(sysdate)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone help me with this?&lt;/P&gt;&lt;P&gt;Please let me know if more information is needed.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Nov 2018 15:05:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Filter-between-previous-Business-day-and-current-date/m-p/512212#M137919</guid>
      <dc:creator>phoenix31</dc:creator>
      <dc:date>2018-11-12T15:05:11Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Filter between previous Business day and current date in the where clause</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Filter-between-previous-Business-day-and-current-date/m-p/512220#M137920</link>
      <description>&lt;P&gt;In SAS, apply the weekday() function to a date. It will return values from 1 to 7 (1 = Sunday, 7 = Saturday).&lt;/P&gt;</description>
      <pubDate>Mon, 12 Nov 2018 15:14:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Filter-between-previous-Business-day-and-current-date/m-p/512220#M137920</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-11-12T15:14:30Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Filter between previous Business day and current date in the where clause</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Filter-between-previous-Business-day-and-current-date/m-p/512221#M137921</link>
      <description>&lt;P&gt;Use intnx function and today():&lt;/P&gt;
&lt;PRE&gt;decode(to_char(sysdate,'D'),2,trunc(sysdate-3),trunc(sysdate-1)) AND  trunc(sysdate)&lt;/PRE&gt;
&lt;P&gt;Something like:&lt;/P&gt;
&lt;PRE&gt;between intnx('month',today(),0,"b") and intnx('month',today(),1,"b")&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Nov 2018 15:17:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Filter-between-previous-Business-day-and-current-date/m-p/512221#M137921</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-11-12T15:17:43Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Filter between previous Business day and current date in the where clause</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Filter-between-previous-Business-day-and-current-date/m-p/512229#M137922</link>
      <description>&lt;P&gt;You may also consider using SQL Pass-thru for Oracle. That way you can leverage your existing SQL query to get the same result from within sas.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Assuming that the SAS/Access to Oracle is licensed :&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;    
  CONNECT TO ORACLE (user=user password="password" path=schema);
  CREATE TABLE LIBRARY.tab_nm AS
   SELECT *       
      FROM CONNECTION TO ORACLE          
       (
           &amp;lt;Your query here&amp;gt;
     	);
  DISCONNECT
  FROM ORACLE; 
 QUIT;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Nov 2018 15:44:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Filter-between-previous-Business-day-and-current-date/m-p/512229#M137922</guid>
      <dc:creator>r_behata</dc:creator>
      <dc:date>2018-11-12T15:44:54Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Filter between previous Business day and current date in the where clause</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Filter-between-previous-Business-day-and-current-date/m-p/512234#M137923</link>
      <description>&lt;P&gt;You may need to consider running an explicit pass-through instead, if your table is very large. When you change it to SAS Query and use some SAS function then those functions may not be converted to Oracle specific by SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your case your trying to use equivalent SAS functions in where clause, if SAS cannot convert them all of the&amp;nbsp;data without the where clause will be brought to SAS Server and where clause will be applied on SAS side instead of Oracle side.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
connect to Oracle (user= password= server=);
create table SAS_Table as 
select * 
from connection to Oracle 
(
select * from tablename where columnname  BETWEEN  decode(to_char(sysdate,'D'),2,trunc(sysdate-3),trunc(sysdate-1)) AND  trunc(sysdate)

);
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Check this &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.2&amp;amp;docsetId=acreldb&amp;amp;docsetTarget=p06jk0u30uhuj5n18fqw9sxr25lk.htm&amp;amp;locale=en" target="_self"&gt;document &lt;/A&gt;to see what formats will be applied by default for the data types in Oracle.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Nov 2018 15:58:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Filter-between-previous-Business-day-and-current-date/m-p/512234#M137923</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2018-11-12T15:58:14Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Filter between previous Business day and current date in the where clause</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Filter-between-previous-Business-day-and-current-date/m-p/512239#M137924</link>
      <description>&lt;P&gt;Thank you.&lt;BR /&gt;I used the below to get the desired result:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;intnx('WEEKDAY',today(),0,"b") and intnx('WEEKDAY',today(),-1,"b")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To get only the prior business day data.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Nov 2018 15:57:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Filter-between-previous-Business-day-and-current-date/m-p/512239#M137924</guid>
      <dc:creator>phoenix31</dc:creator>
      <dc:date>2018-11-12T15:57:52Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Filter between previous Business day and current date in the where clause</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Filter-between-previous-Business-day-and-current-date/m-p/512240#M137925</link>
      <description>&lt;P&gt;Thank you so much!&lt;/P&gt;&lt;P&gt;I used your query and updated month to weekday to get business days only.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;P&gt;between intnx('WEEKDAY',today(),0,"b") and intnx('WEEKDAY',today(),-1,"b")&lt;/P&gt;</description>
      <pubDate>Mon, 12 Nov 2018 15:59:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Filter-between-previous-Business-day-and-current-date/m-p/512240#M137925</guid>
      <dc:creator>phoenix31</dc:creator>
      <dc:date>2018-11-12T15:59:14Z</dc:date>
    </item>
  </channel>
</rss>

