<?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 Unable to convert SQL server datetime 1960 values to the actual date time values in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-SQL-server-datetime-1960-values-to-the-actual/m-p/618051#M19161</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm query-ing an MS SQL server tabel from SAS.&lt;/P&gt;&lt;P&gt;In SQL Server there is a datetime field which has only got date vaules in 1960, for instance :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1960-01-01 05:40:53.000&lt;/P&gt;&lt;P&gt;1960-01-01 05:45:27.000&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to convert these to date values&lt;/P&gt;&lt;P&gt;When I run &lt;EM&gt;implicit&lt;/EM&gt; code this works :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;&lt;FONT face="Courier New"&gt;put(&amp;lt;datetime field sql server&amp;gt;, &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New"&gt;ddmmyy10.&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This way 01JAN1960:05:52:03.000 is converted to 31/10/2017, which is correct.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I would not know how to convert this in explicit code . Which SQL server function should I use ?&lt;/P&gt;&lt;P&gt;The datetype SQL Server uses is DATETIME.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks !!&lt;/P&gt;&lt;P&gt;Rgds&lt;/P&gt;&lt;P&gt;BB&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;&lt;FONT face="Courier New" size="1"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 17 Jan 2020 11:52:25 GMT</pubDate>
    <dc:creator>Billybob73</dc:creator>
    <dc:date>2020-01-17T11:52:25Z</dc:date>
    <item>
      <title>Unable to convert SQL server datetime 1960 values to the actual date time values</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-SQL-server-datetime-1960-values-to-the-actual/m-p/618051#M19161</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm query-ing an MS SQL server tabel from SAS.&lt;/P&gt;&lt;P&gt;In SQL Server there is a datetime field which has only got date vaules in 1960, for instance :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1960-01-01 05:40:53.000&lt;/P&gt;&lt;P&gt;1960-01-01 05:45:27.000&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to convert these to date values&lt;/P&gt;&lt;P&gt;When I run &lt;EM&gt;implicit&lt;/EM&gt; code this works :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;&lt;FONT face="Courier New"&gt;put(&amp;lt;datetime field sql server&amp;gt;, &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New"&gt;ddmmyy10.&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This way 01JAN1960:05:52:03.000 is converted to 31/10/2017, which is correct.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I would not know how to convert this in explicit code . Which SQL server function should I use ?&lt;/P&gt;&lt;P&gt;The datetype SQL Server uses is DATETIME.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks !!&lt;/P&gt;&lt;P&gt;Rgds&lt;/P&gt;&lt;P&gt;BB&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;&lt;FONT face="Courier New" size="1"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2020 11:52:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-SQL-server-datetime-1960-values-to-the-actual/m-p/618051#M19161</guid>
      <dc:creator>Billybob73</dc:creator>
      <dc:date>2020-01-17T11:52:25Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to convert SQL server datetime 1960 values to the actual date time values</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-SQL-server-datetime-1960-values-to-the-actual/m-p/618055#M19162</link>
      <description>&lt;P&gt;Microsoft uses the same base (count of days) for dates and datetimes. Basically, everything is a datetime value, with pure time values as fractions in the range 0 to 1.&lt;/P&gt;
&lt;P&gt;SAS uses counts of seconds for datetimes and times. What I would do is simply assign a date format to the variable after import.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2020 12:02:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-SQL-server-datetime-1960-values-to-the-actual/m-p/618055#M19162</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-01-17T12:02:39Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to convert SQL server datetime 1960 values to the actual date time values</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-SQL-server-datetime-1960-values-to-the-actual/m-p/618063#M19163</link>
      <description>&lt;P&gt;Hi Kurt,&lt;/P&gt;&lt;P&gt;Thanks for your answer. I cannot do this implicitely. The thing is that i'm writing code to improve performance so I just have to find the solution on the SQL server side. Would you know the SQL server function to do this ? I've been googling a lot but cannot find this solution.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;BB&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2020 12:34:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-SQL-server-datetime-1960-values-to-the-actual/m-p/618063#M19163</guid>
      <dc:creator>Billybob73</dc:creator>
      <dc:date>2020-01-17T12:34:38Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to convert SQL server datetime 1960 values to the actual date time values</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-SQL-server-datetime-1960-values-to-the-actual/m-p/618064#M19164</link>
      <description>&lt;P&gt;Has nothing to do with performance. You get the correct&amp;nbsp;&lt;EM&gt;value&lt;/EM&gt; from the SQL Server, it just needs the correct&amp;nbsp;&lt;EM&gt;format&lt;/EM&gt;, and that is done on the SAS side in fractions of a second, or no time at all with a format= in SQL while you load the data.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2020 12:39:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-SQL-server-datetime-1960-values-to-the-actual/m-p/618064#M19164</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-01-17T12:39:01Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to convert SQL server datetime 1960 values to the actual date time values</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-SQL-server-datetime-1960-values-to-the-actual/m-p/618066#M19165</link>
      <description>&lt;P&gt;Kurt&lt;/P&gt;&lt;P&gt;It has indirectly. I need the conversion in a broader perspective. It's part of a huge query.&lt;/P&gt;&lt;P&gt;Explicit is always faster than implicit. There's a lot of transformations and conversions in the original implicit code.&lt;/P&gt;&lt;P&gt;I want the SQL server database to process. Therefore I'm transforming all of the SAS functions to SQL server functions.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Rgds&lt;/P&gt;&lt;P&gt;BB&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2020 12:50:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-SQL-server-datetime-1960-values-to-the-actual/m-p/618066#M19165</guid>
      <dc:creator>Billybob73</dc:creator>
      <dc:date>2020-01-17T12:50:03Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to convert SQL server datetime 1960 values to the actual date time values</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-SQL-server-datetime-1960-values-to-the-actual/m-p/618135#M19174</link>
      <description>&lt;P&gt;If you need help with implementing your logic in MS SQL Server, you should ask for it in a Microsoft-oriented forum. I fear we here can't give much help with that SQL dialect.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2020 16:55:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-SQL-server-datetime-1960-values-to-the-actual/m-p/618135#M19174</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-01-17T16:55:00Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to convert SQL server datetime 1960 values to the actual date time values</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-SQL-server-datetime-1960-values-to-the-actual/m-p/618138#M19176</link>
      <description>&lt;P&gt;Your question does not make much sense.&lt;/P&gt;
&lt;P&gt;Are you saying that you have a number that Oracle thinks is some time on January first 1960 and you want to convert it to a date in the year 2017?&amp;nbsp; What is the logic for this conversion?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is it possible you loaded a SAS date value into an Oracle datetime variable without the proper conversion of units?&amp;nbsp; Can you go back and fix the process that loaded the value originally instead of trying to fix the Oracle data after the fact?&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2020 17:06:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Unable-to-convert-SQL-server-datetime-1960-values-to-the-actual/m-p/618138#M19176</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-01-17T17:06:03Z</dc:date>
    </item>
  </channel>
</rss>

