<?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: Extract data of a month based on today's date in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Extract-data-of-a-month-based-on-today-s-date/m-p/851648#M37391</link>
    <description>&lt;P&gt;Try this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let Txn_Date = %str(%')%sysfunc(today(), yymmddd10.)%str(%');
%put &amp;amp;Txn_Date;

Proc sql;
connect to ODBC as users
(dsn=****** uid=****** pwd="*****");
create table TXN as
select *
from connection to users
(select*
from RPT_OBIE.TABLE_TXNS_FIN
WHERE DAT_TXN &amp;gt;= &amp;amp;Txn_Date
AND QR_FLG='YES'
AND TXN_TYPE IN ('CREDIT','PAY')
AND TXN_STATUS IN ('SUCCESS')
);
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 30 Dec 2022 21:06:29 GMT</pubDate>
    <dc:creator>SASKiwi</dc:creator>
    <dc:date>2022-12-30T21:06:29Z</dc:date>
    <item>
      <title>Extract data of a month based on today's date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Extract-data-of-a-month-based-on-today-s-date/m-p/851304#M37342</link>
      <description>&lt;P&gt;The below code is throwing an error:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;Proc sql;
connect to ODBC as users
(dsn=****** uid=****** pwd="*****");
create table TXN as
select *
from connection to users
(select*
from RPT_OBIE.TABLE_TXNS_FIN
WHERE DAT_TXN &amp;gt;= DATEPART(MONTH, today())
AND QR_FLG='YES'
AND TXN_TYPE IN ('CREDIT','PAY')
AND TXN_STATUS IN ('SUCCESS')
);
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;The Error: CLI describe error is always showing every time I try to use any date function such as today(), sysdate(), intck. I want the above code to extract data for the whole month based on todays date from the data base. The code is working fine when I am using a system data but its throwing an error when I am fetching data from Database.&lt;/P&gt;&lt;PRE&gt;ERROR: CLI describe error: [Oracle][ODBC][Ora]ORA-00904: "DATEPART": invalid identifier&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Can anyone help!!&lt;/P&gt;</description>
      <pubDate>Wed, 28 Dec 2022 05:55:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Extract-data-of-a-month-based-on-today-s-date/m-p/851304#M37342</guid>
      <dc:creator>Kirito1</dc:creator>
      <dc:date>2022-12-28T05:55:21Z</dc:date>
    </item>
    <item>
      <title>Re: Extract data of a month based on today's date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Extract-data-of-a-month-based-on-today-s-date/m-p/851307#M37343</link>
      <description>&lt;P&gt;Afaik you can't use sas functions in sql-pass-through.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Dec 2022 06:53:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Extract-data-of-a-month-based-on-today-s-date/m-p/851307#M37343</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2022-12-28T06:53:45Z</dc:date>
    </item>
    <item>
      <title>Re: Extract data of a month based on today's date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Extract-data-of-a-month-based-on-today-s-date/m-p/851309#M37344</link>
      <description>&lt;P&gt;In the explicit pass-through, you must use pure Oracle syntax. SAS functions will not work there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The SAS DATEPART function accepts only&amp;nbsp;&lt;U&gt;one&lt;/U&gt; parameter, which has to be a datetime.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instead of &lt;EM&gt;calculating&lt;/EM&gt; the cutoff in Oracle, deliver it as a Oracle-compatible datetime literal, which you first store into a macro variable on the SAS side.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to use explicit pass-through, you need to get versed in the target database's syntax first.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Dec 2022 07:58:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Extract-data-of-a-month-based-on-today-s-date/m-p/851309#M37344</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-12-28T07:58:22Z</dc:date>
    </item>
    <item>
      <title>Re: Extract data of a month based on today's date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Extract-data-of-a-month-based-on-today-s-date/m-p/851322#M37345</link>
      <description>Are you sure about that? I mean any article or blog or any paper states this if yes then Please provide.</description>
      <pubDate>Wed, 28 Dec 2022 10:56:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Extract-data-of-a-month-based-on-today-s-date/m-p/851322#M37345</guid>
      <dc:creator>Kirito1</dc:creator>
      <dc:date>2022-12-28T10:56:16Z</dc:date>
    </item>
    <item>
      <title>Re: Extract data of a month based on today's date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Extract-data-of-a-month-based-on-today-s-date/m-p/851346#M37349</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/437885"&gt;@Kirito1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Are you sure about that? I mean any article or blog or any paper states this if yes then Please provide.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Why do you need a blog or paper, when the LOG message is telling you clearly you can't use the DATEPART function in passthru? This means ... SAS is telling you that you can't do it. It doesn't get more authoritative than that.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Dec 2022 14:25:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Extract-data-of-a-month-based-on-today-s-date/m-p/851346#M37349</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-12-28T14:25:26Z</dc:date>
    </item>
    <item>
      <title>Re: Extract data of a month based on today's date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Extract-data-of-a-month-based-on-today-s-date/m-p/851358#M37350</link>
      <description>&lt;P&gt;You certainly can't use a SAS function within explicit pass-through SQL code. The SQL syntax within this explicit portion must be in the syntax of the database you're running it under.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can't test it but in your case interfacing with Oracle it's likely something like:&lt;/P&gt;
&lt;PRE&gt;WHERE DAT_TXN &amp;gt;= TRUNC(sysdate, 'MONTH')&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Dec 2022 15:13:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Extract-data-of-a-month-based-on-today-s-date/m-p/851358#M37350</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2022-12-28T15:13:22Z</dc:date>
    </item>
    <item>
      <title>Re: Extract data of a month based on today's date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Extract-data-of-a-month-based-on-today-s-date/m-p/851575#M37387</link>
      <description>Did you read my Query completely? ........I tried using every Possible function for date. This was just a sample.</description>
      <pubDate>Fri, 30 Dec 2022 06:04:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Extract-data-of-a-month-based-on-today-s-date/m-p/851575#M37387</guid>
      <dc:creator>Kirito1</dc:creator>
      <dc:date>2022-12-30T06:04:39Z</dc:date>
    </item>
    <item>
      <title>Re: Extract data of a month based on today's date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Extract-data-of-a-month-based-on-today-s-date/m-p/851576#M37388</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It bought the desired output but threw&amp;nbsp; an error for database code.&lt;/P&gt;&lt;PRE&gt;ERROR: CLI describe error: [Oracle][ODBC][Ora]ORA-00936: missing expression&lt;/PRE&gt;&lt;P&gt;I mean its OK! but is it a problem I feel like It should not be. Any opinions.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Dec 2022 06:13:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Extract-data-of-a-month-based-on-today-s-date/m-p/851576#M37388</guid>
      <dc:creator>Kirito1</dc:creator>
      <dc:date>2022-12-30T06:13:23Z</dc:date>
    </item>
    <item>
      <title>Re: Extract data of a month based on today's date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Extract-data-of-a-month-based-on-today-s-date/m-p/851584#M37389</link>
      <description>&lt;P&gt;You&amp;nbsp;&lt;STRONG&gt;must&lt;/STRONG&gt; study the Oracle documentation, or get help from your database people in writing the query.&lt;/P&gt;
&lt;P&gt;You might also go to the &lt;A href="https://community.oracle.com" target="_self"&gt;Oracle Community&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Dec 2022 08:28:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Extract-data-of-a-month-based-on-today-s-date/m-p/851584#M37389</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-12-30T08:28:05Z</dc:date>
    </item>
    <item>
      <title>Re: Extract data of a month based on today's date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Extract-data-of-a-month-based-on-today-s-date/m-p/851597#M37390</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/437885"&gt;@Kirito1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It bought the desired output but threw&amp;nbsp; an error for database code.&lt;/P&gt;
&lt;PRE&gt;ERROR: CLI describe error: [Oracle][ODBC][Ora]ORA-00936: missing expression&lt;/PRE&gt;
&lt;P&gt;I mean its OK! but is it a problem I feel like It should not be. Any opinions.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If Oracle returns an Error condition then it's certainly an issue.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I normally first develop and debug SQL pass-through code directly via a database client like DBeaver or SQL Developer. Only once I've got fully working code I "wrap" SAS around it.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Dec 2022 10:24:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Extract-data-of-a-month-based-on-today-s-date/m-p/851597#M37390</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2022-12-30T10:24:46Z</dc:date>
    </item>
    <item>
      <title>Re: Extract data of a month based on today's date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Extract-data-of-a-month-based-on-today-s-date/m-p/851648#M37391</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let Txn_Date = %str(%')%sysfunc(today(), yymmddd10.)%str(%');
%put &amp;amp;Txn_Date;

Proc sql;
connect to ODBC as users
(dsn=****** uid=****** pwd="*****");
create table TXN as
select *
from connection to users
(select*
from RPT_OBIE.TABLE_TXNS_FIN
WHERE DAT_TXN &amp;gt;= &amp;amp;Txn_Date
AND QR_FLG='YES'
AND TXN_TYPE IN ('CREDIT','PAY')
AND TXN_STATUS IN ('SUCCESS')
);
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 30 Dec 2022 21:06:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Extract-data-of-a-month-based-on-today-s-date/m-p/851648#M37391</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2022-12-30T21:06:29Z</dc:date>
    </item>
  </channel>
</rss>

