<?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 teradata pass through, getting wrong date range in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/teradata-pass-through-getting-wrong-date-range/m-p/386276#M92485</link>
    <description>&lt;P&gt;When I use the below code I get a date range from 31JAN2011 to 30JUN2017.&amp;nbsp; When I pull this data in teradata studio the date is in the format of 'yyyy-mm-dd'.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have tried using datepart, or using the date like this date'2016-12-31'.&amp;nbsp; I have also tried doing '2015-12-31' &amp;lt;= load_date &amp;lt;= '2016-12-31'.&amp;nbsp; Nothing seems to be working for me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any ideas are appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql ;&lt;BR /&gt;connect to TERADATA(SERVER=TPRDDB user=&amp;amp;USER&amp;nbsp; password= "&amp;amp;PW" mode=teradata SESSIONS=200);&lt;BR /&gt;create table FDR_NCC_MASTER_RECORD as select * from connection to TERADATA&lt;BR /&gt;(&lt;BR /&gt;select &lt;BR /&gt;LOAD_DATE,&lt;BR /&gt;origacct,&lt;BR /&gt;credline,&lt;BR /&gt;extstat_pm&lt;BR /&gt;from EDWTD01P_ETL_STAGE_V.FDR_NCC_CONSUMER&lt;BR /&gt;where LOAD_DATE BETWEEN '2015-12-31' and '2016-12-31' and&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; extstat_pm not in('B','Z','C') or &lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; extstat_pm = ''&lt;BR /&gt;order by origacct,load_date&lt;BR /&gt;;&lt;BR /&gt;);&lt;BR /&gt;disconnect from TERADATA;&lt;BR /&gt;quit;&lt;/P&gt;</description>
    <pubDate>Tue, 08 Aug 2017 14:25:10 GMT</pubDate>
    <dc:creator>Steelers_In_DC</dc:creator>
    <dc:date>2017-08-08T14:25:10Z</dc:date>
    <item>
      <title>teradata pass through, getting wrong date range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/teradata-pass-through-getting-wrong-date-range/m-p/386276#M92485</link>
      <description>&lt;P&gt;When I use the below code I get a date range from 31JAN2011 to 30JUN2017.&amp;nbsp; When I pull this data in teradata studio the date is in the format of 'yyyy-mm-dd'.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have tried using datepart, or using the date like this date'2016-12-31'.&amp;nbsp; I have also tried doing '2015-12-31' &amp;lt;= load_date &amp;lt;= '2016-12-31'.&amp;nbsp; Nothing seems to be working for me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any ideas are appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql ;&lt;BR /&gt;connect to TERADATA(SERVER=TPRDDB user=&amp;amp;USER&amp;nbsp; password= "&amp;amp;PW" mode=teradata SESSIONS=200);&lt;BR /&gt;create table FDR_NCC_MASTER_RECORD as select * from connection to TERADATA&lt;BR /&gt;(&lt;BR /&gt;select &lt;BR /&gt;LOAD_DATE,&lt;BR /&gt;origacct,&lt;BR /&gt;credline,&lt;BR /&gt;extstat_pm&lt;BR /&gt;from EDWTD01P_ETL_STAGE_V.FDR_NCC_CONSUMER&lt;BR /&gt;where LOAD_DATE BETWEEN '2015-12-31' and '2016-12-31' and&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; extstat_pm not in('B','Z','C') or &lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; extstat_pm = ''&lt;BR /&gt;order by origacct,load_date&lt;BR /&gt;;&lt;BR /&gt;);&lt;BR /&gt;disconnect from TERADATA;&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Aug 2017 14:25:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/teradata-pass-through-getting-wrong-date-range/m-p/386276#M92485</guid>
      <dc:creator>Steelers_In_DC</dc:creator>
      <dc:date>2017-08-08T14:25:10Z</dc:date>
    </item>
    <item>
      <title>Re: teradata pass through, getting wrong date range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/teradata-pass-through-getting-wrong-date-range/m-p/386281#M92486</link>
      <description>&lt;P&gt;I think your should use date literals, not strings:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;where LOAD_DATE BETWEEN '31JAN2011'd and '30JUN2017'd and...&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Note the d after the dates.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Aug 2017 14:34:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/teradata-pass-through-getting-wrong-date-range/m-p/386281#M92486</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-08-08T14:34:33Z</dc:date>
    </item>
    <item>
      <title>Re: teradata pass through, getting wrong date range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/teradata-pass-through-getting-wrong-date-range/m-p/386284#M92487</link>
      <description>&lt;P&gt;When I run that i get the following error:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Teradata prepare: Syntax error, expected something like an 'AND' keyword between a string or a Unicode character literal and&lt;/P&gt;
&lt;P&gt;the word 'd'.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Aug 2017 14:40:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/teradata-pass-through-getting-wrong-date-range/m-p/386284#M92487</guid>
      <dc:creator>Steelers_In_DC</dc:creator>
      <dc:date>2017-08-08T14:40:00Z</dc:date>
    </item>
    <item>
      <title>Re: teradata pass through, getting wrong date range</title>
      <link>https://communities.sas.com/t5/SAS-Programming/teradata-pass-through-getting-wrong-date-range/m-p/386287#M92488</link>
      <description>&lt;P&gt;I think the error is probably in the other parts of your WHERE condition.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;create table FDR_NCC_MASTER_RECORD as 
  select * from connection to TERADATA
(
select LOAD_DATE
     , origacct
     , credline
     , extstat_pm
from EDWTD01P_ETL_STAGE_V.FDR_NCC_CONSUMER
where LOAD_DATE BETWEEN '2015-12-31' and '2016-12-31'
  and extstat_pm not in('B','Z','C') 
  or  extstat_pm = ''
order by origacct , load_date
)
;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;What did you mean by the last condition? &amp;nbsp;Are you intendting that to match NULL values in Teradata? &amp;nbsp;And if it did (which I doubt it will) then that means you all taking all observations with missing EXSTAT_PM not matter what value of LOAD_DATE they have.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also you could explicitly let Teradata know that the you meant date literals, but ti is probably not required.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where LOAD_DATE BETWEEN DATE'2015-12-31' and DATE'2016-12-31'
  and (extstat_pm not in('B','Z','C') or extstat_pm is null)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 08 Aug 2017 14:45:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/teradata-pass-through-getting-wrong-date-range/m-p/386287#M92488</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-08-08T14:45:37Z</dc:date>
    </item>
  </channel>
</rss>

