<?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: SQL Server and Dates in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/SQL-Server-and-Dates/m-p/42737#M11129</link>
    <description>If you want t use SQL Server functions, you need to enclose your query using explicit SQL pass-thru. &lt;BR /&gt;
You could also use SAS functions/formats, even in the SQL that is reading your SQL Server table(s). &lt;BR /&gt;
No need for a subsequent data step, unless if you feel more comfortable by doing so. &lt;BR /&gt;
Use the DATEPART function to convert datetime values to dates.&lt;BR /&gt;
&lt;BR /&gt;
/Linus</description>
    <pubDate>Wed, 10 Jun 2009 16:48:12 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2009-06-10T16:48:12Z</dc:date>
    <item>
      <title>SQL Server and Dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SQL-Server-and-Dates/m-p/42736#M11128</link>
      <description>I am trying to retrieve SmallDateTime and DateTime data from SQL Server and having trouble getting it to useful formats.  Sometimes I need just the dates, sometimes I need the full datetime, sometimes I need to use the SQL Server DateDiff to get hours difference, or minutes or something.  Help!&lt;BR /&gt;
&lt;BR /&gt;
Anyway to do something like:&lt;BR /&gt;
PROC SQL;&lt;BR /&gt;
CREATE TABLE XXX AS&lt;BR /&gt;
SELECT DateDiff(hh,Date1,Date2) as HoursDifference&lt;BR /&gt;
FROM  mySQLTable;&lt;BR /&gt;
&lt;BR /&gt;
Or can I read the raw dates and apply some inFormat or Format right in the SQL?  I can get the difference in a second data step?&lt;BR /&gt;
&lt;BR /&gt;
Or can I read the raw dates as text then convert them somehow to a datetime format in a second data step?&lt;BR /&gt;
&lt;BR /&gt;
How do people normal work with SQL Server DateTime values?????</description>
      <pubDate>Tue, 09 Jun 2009 21:56:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SQL-Server-and-Dates/m-p/42736#M11128</guid>
      <dc:creator>MikePHFEWIC</dc:creator>
      <dc:date>2009-06-09T21:56:11Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Server and Dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SQL-Server-and-Dates/m-p/42737#M11129</link>
      <description>If you want t use SQL Server functions, you need to enclose your query using explicit SQL pass-thru. &lt;BR /&gt;
You could also use SAS functions/formats, even in the SQL that is reading your SQL Server table(s). &lt;BR /&gt;
No need for a subsequent data step, unless if you feel more comfortable by doing so. &lt;BR /&gt;
Use the DATEPART function to convert datetime values to dates.&lt;BR /&gt;
&lt;BR /&gt;
/Linus</description>
      <pubDate>Wed, 10 Jun 2009 16:48:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SQL-Server-and-Dates/m-p/42737#M11129</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2009-06-10T16:48:12Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Server and Dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/SQL-Server-and-Dates/m-p/42738#M11130</link>
      <description>Alternatively, run the SQL in sas and use sas functions:&lt;BR /&gt;
[pre]&lt;BR /&gt;
PROC SQL;&lt;BR /&gt;
CREATE TABLE XXX AS&lt;BR /&gt;
SELECT intck('hour',Datetime1,Datetime2) as HoursDifference&lt;BR /&gt;
FROM mySQLTable;</description>
      <pubDate>Mon, 15 Jun 2009 23:53:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/SQL-Server-and-Dates/m-p/42738#M11130</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2009-06-15T23:53:49Z</dc:date>
    </item>
  </channel>
</rss>

