<?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 SAS and Use of Date Functions with ODBC Data in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/SAS-and-Use-of-Date-Functions-with-ODBC-Data/m-p/68880#M19736</link>
    <description>I am working with data from MS SQL Server that is surfaced in SAS as a data library via SAS Access for ODBC and wanted to know if there is a system option that treats the MS SQL data type of DATETIME as a SAS date instead of a SAS DATETIME.  Right now I am having to use the datepart function to extract the date prior to doing any date comparisons.  ANy ideas or am I stuck with using the datepart function?</description>
    <pubDate>Thu, 03 Feb 2011 20:40:32 GMT</pubDate>
    <dc:creator>JDMTX</dc:creator>
    <dc:date>2011-02-03T20:40:32Z</dc:date>
    <item>
      <title>SAS and Use of Date Functions with ODBC Data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-and-Use-of-Date-Functions-with-ODBC-Data/m-p/68880#M19736</link>
      <description>I am working with data from MS SQL Server that is surfaced in SAS as a data library via SAS Access for ODBC and wanted to know if there is a system option that treats the MS SQL data type of DATETIME as a SAS date instead of a SAS DATETIME.  Right now I am having to use the datepart function to extract the date prior to doing any date comparisons.  ANy ideas or am I stuck with using the datepart function?</description>
      <pubDate>Thu, 03 Feb 2011 20:40:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-and-Use-of-Date-Functions-with-ODBC-Data/m-p/68880#M19736</guid>
      <dc:creator>JDMTX</dc:creator>
      <dc:date>2011-02-03T20:40:32Z</dc:date>
    </item>
    <item>
      <title>Re: SAS and Use of Date Functions with ODBC Data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-and-Use-of-Date-Functions-with-ODBC-Data/m-p/68881#M19737</link>
      <description>Stuck with Datetime. Welcome to the club.</description>
      <pubDate>Thu, 03 Feb 2011 20:57:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-and-Use-of-Date-Functions-with-ODBC-Data/m-p/68881#M19737</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2011-02-03T20:57:45Z</dc:date>
    </item>
    <item>
      <title>Re: SAS and Use of Date Functions with ODBC Data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-and-Use-of-Date-Functions-with-ODBC-Data/m-p/68882#M19738</link>
      <description>I understand how datepart() can damage performance, and so, why you want to avoid it: here are some tips&lt;BR /&gt;
1 compare datetime columns with date constants extended into datetime constants like[pre]    where SQL_date_column between "&amp;amp;date1:0:0:0"dt and "&amp;amp;date2:0:0:0"dt[/pre] with just date constants in &amp;amp;date1 and &amp;amp;date2&lt;BR /&gt;
 &lt;BR /&gt;
2 for the INTNX() function there are DTxxxxx intervals&lt;BR /&gt;
 &lt;BR /&gt;
3 for formatting there are DTxxxxx formats like DTDATE9 to display just the date part of a datetime value. There are also some NLxxxxx formats which might help with datetime values. &lt;BR /&gt;
 &lt;BR /&gt;
It is not a complete solution but deals with some of the trouble. &lt;BR /&gt;
 &lt;BR /&gt;
PeterC</description>
      <pubDate>Fri, 04 Feb 2011 09:08:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-and-Use-of-Date-Functions-with-ODBC-Data/m-p/68882#M19738</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2011-02-04T09:08:30Z</dc:date>
    </item>
    <item>
      <title>Re: SAS and Use of Date Functions with ODBC Data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-and-Use-of-Date-Functions-with-ODBC-Data/m-p/68883#M19739</link>
      <description>Peter -&lt;BR /&gt;
&lt;BR /&gt;
Based upon your earlier reply, is the following statement true: "Even if I apply a format like DTDATE9. it is necessary to treat the underlying value as a datetime value when applying a subseting if statment in a data step as it is not possible to use a date constant short of creating a new variable that contains only the datepart or extend a date constant into a datetime constant (example:  "&amp;amp;date2:0:0:0"dt)."</description>
      <pubDate>Sat, 05 Feb 2011 21:58:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-and-Use-of-Date-Functions-with-ODBC-Data/m-p/68883#M19739</guid>
      <dc:creator>JDMTX</dc:creator>
      <dc:date>2011-02-05T21:58:45Z</dc:date>
    </item>
    <item>
      <title>Re: SAS and Use of Date Functions with ODBC Data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-and-Use-of-Date-Functions-with-ODBC-Data/m-p/68884#M19740</link>
      <description>&amp;gt; Peter -&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Based upon your earlier reply, is the following&lt;BR /&gt;
&amp;gt; statement true: "Even if I apply a format like&lt;BR /&gt;
&amp;gt; DTDATE9. it is necessary to treat the underlying&lt;BR /&gt;
&amp;gt; value as a datetime value when applying a subseting&lt;BR /&gt;
&amp;gt; if statment in a data step as it is not possible to&lt;BR /&gt;
&amp;gt; use a date constant short of creating a new variable&lt;BR /&gt;
&amp;gt; that contains only the datepart or extend a date&lt;BR /&gt;
&amp;gt; constant into a datetime constant (example:&lt;BR /&gt;
&amp;gt;  "&amp;amp;date2:0:0:0"dt)."&lt;BR /&gt;
&lt;BR /&gt;
I consider this true, as I think "&amp;amp;date2:0:0:0"dt will use that date constant correctly.&lt;BR /&gt;
&lt;BR /&gt;
I think this extract&lt;BR /&gt;
&amp;gt; ............................. it is not possible to&lt;BR /&gt;
&amp;gt; use a date constant &lt;BR /&gt;
is false&lt;BR /&gt;
My reasoning for working with datetime values in data step or sql programming :&lt;BR /&gt;
 avoid functions (like datepart) that might cause an entire teradata or oracle table to be passed to SAS for processing.&lt;BR /&gt;
It is neither difficult nor unclear (imho) to extend a sas date constant into a datetime constant. &lt;BR /&gt;
If it is possible that the dbms column of datetime type might hold a time value as well as a date value, rather than seek equality with &amp;amp;date2:0:0:0"dt, we can use a range like &lt;BR /&gt;
where dbms_datetime between "&amp;amp;sasdate:00:0"dt and "&amp;amp;sasdate:24:0:0"dt&lt;BR /&gt;
in place of&lt;BR /&gt;
where datepart( dbms_datetime) = "&amp;amp;sasdate"d</description>
      <pubDate>Sat, 05 Feb 2011 23:56:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-and-Use-of-Date-Functions-with-ODBC-Data/m-p/68884#M19740</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2011-02-05T23:56:10Z</dc:date>
    </item>
    <item>
      <title>Re: SAS and Use of Date Functions with ODBC Data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SAS-and-Use-of-Date-Functions-with-ODBC-Data/m-p/68885#M19741</link>
      <description>Hi.&lt;BR /&gt;
Refer to it.&lt;BR /&gt;
&lt;A href="http://support.sas.com/kb/6/413.html" target="_blank"&gt;http://support.sas.com/kb/6/413.html&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Thu, 17 Feb 2011 05:36:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SAS-and-Use-of-Date-Functions-with-ODBC-Data/m-p/68885#M19741</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-02-17T05:36:54Z</dc:date>
    </item>
  </channel>
</rss>

