<?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: libname SAS- Oracle dates in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/libname-SAS-Oracle-dates/m-p/521370#M141461</link>
    <description>&lt;P&gt;I guess if you ask for DBSASTYPE=(PAID_DT=DATE), you don't need to use datepart() on paid_dt.&lt;/P&gt;</description>
    <pubDate>Fri, 14 Dec 2018 04:55:26 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2018-12-14T04:55:26Z</dc:date>
    <item>
      <title>libname SAS- Oracle dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/libname-SAS-Oracle-dates/m-p/521368#M141459</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello SAS Users,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wanted some help to clear this error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am merging SAS dataset leftouter join to ORacle table (many to one join), I am getting the dates error. How to resolve this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PAID_DT variable is DATE format in oracle table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Libname test oracle &amp;nbsp;&amp;nbsp; &amp;nbsp;user = &amp;amp;MyId orapw=&amp;amp;mypwd&amp;nbsp; path = "&amp;amp;Mydb" schema = Test&amp;nbsp; Oracle_73 = NO;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table select a.* , &amp;nbsp;case when b.CLM_ID is null then '0' else '1' end as test_case&lt;/P&gt;&lt;P&gt;from output_all&amp;nbsp; a left outer join&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; test.sum_oracle_table (DBKEY=CLM_ID&amp;nbsp; DBSASTYPE=(PAID_DT=DATE)) b&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; on put(datepart(b.PAID_DT),yymmddd10.) between '2017-10-01' and '2018-03-31'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and a.clm_id = b.clm_id&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;BR /&gt;ERROR: Error fetching from cursor. ORACLE error is ORA-01843: not a valid month.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Dec 2018 04:34:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/libname-SAS-Oracle-dates/m-p/521368#M141459</guid>
      <dc:creator>SASAna</dc:creator>
      <dc:date>2018-12-14T04:34:02Z</dc:date>
    </item>
    <item>
      <title>Re: libname SAS- Oracle dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/libname-SAS-Oracle-dates/m-p/521370#M141461</link>
      <description>&lt;P&gt;I guess if you ask for DBSASTYPE=(PAID_DT=DATE), you don't need to use datepart() on paid_dt.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Dec 2018 04:55:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/libname-SAS-Oracle-dates/m-p/521370#M141461</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-12-14T04:55:26Z</dc:date>
    </item>
    <item>
      <title>Re: libname SAS- Oracle dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/libname-SAS-Oracle-dates/m-p/521405#M141473</link>
      <description>&lt;P&gt;There are several errors and bad coding here before even looking at the code, create table with nothing stipulated, not finished block, upper case coding etc. all of which combine to make the code next to impossible to read.&amp;nbsp; So:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc sql;
  create table want as 
  select  a.*,  
          case when b.clm_id is null then '0' 
               else '1' end as test_case
  from    output_all a 
  left outer join test.sum_oracle_table (dbkey=clm_id  dbsastype=paid_dt=date)) b
  on      put(datepart(b.paid_dt),yymmddd10.) between '2017-10-01' and '2018-03-31'
  and     a.clm_id=b.clm_id;
quit;&lt;/PRE&gt;
&lt;P&gt;Now obviously as you have not provided and test data in the form of a datastep, or shown what the data is its hard to guess, but I would say you either have the put() date wrong or the between two text strings (it depends on where the code is executed).&amp;nbsp; I would suggest that:&lt;/P&gt;
&lt;PRE&gt;  on      b.paid_dt between '01OCT2017'd and '31MAR2018'd
&lt;/PRE&gt;
&lt;P&gt;Would be more appropriate, however I cannot try it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Dec 2018 09:21:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/libname-SAS-Oracle-dates/m-p/521405#M141473</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-12-14T09:21:55Z</dc:date>
    </item>
    <item>
      <title>Re: libname SAS- Oracle dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/libname-SAS-Oracle-dates/m-p/521413#M141476</link>
      <description>&lt;P&gt;paid_dt is already a date (per your dbsastype= option), so you must not use datepart() on it.&lt;/P&gt;
&lt;P&gt;If paid_dt is a datetime value in Oracle, use dbsastype=(paid_dt=datetime).&lt;/P&gt;</description>
      <pubDate>Fri, 14 Dec 2018 09:51:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/libname-SAS-Oracle-dates/m-p/521413#M141476</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-12-14T09:51:18Z</dc:date>
    </item>
  </channel>
</rss>

