<?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 Data types - moving data to SQL Server in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Data-types-moving-data-to-SQL-Server/m-p/32342#M7775</link>
    <description>I have many SAS data files, that I need to move to SQL Server.&lt;BR /&gt;
The date and time fields keep erroring out. &lt;BR /&gt;
I am doing a simple &lt;BR /&gt;
insert into table (fields)&lt;BR /&gt;
select fields from SAS table&lt;BR /&gt;
for the date fields I have tried put (dob, date10.) as dob - and that errors out with a Conversion Failed when converting date and /or time from character string.&lt;BR /&gt;
Same thing with time fields  - I tried put (collecttime, time8.) as time&lt;BR /&gt;
The data in SAS are formatted as Number 5 YYMMDDN8&lt;BR /&gt;
and Number 5 Time8.&lt;BR /&gt;
The data I want in SQL Server 2008 would be a time(7) for the times and date for the dates. &lt;BR /&gt;
&lt;BR /&gt;
Any recommendations?</description>
    <pubDate>Mon, 07 Jun 2010 14:42:10 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2010-06-07T14:42:10Z</dc:date>
    <item>
      <title>Data types - moving data to SQL Server</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Data-types-moving-data-to-SQL-Server/m-p/32342#M7775</link>
      <description>I have many SAS data files, that I need to move to SQL Server.&lt;BR /&gt;
The date and time fields keep erroring out. &lt;BR /&gt;
I am doing a simple &lt;BR /&gt;
insert into table (fields)&lt;BR /&gt;
select fields from SAS table&lt;BR /&gt;
for the date fields I have tried put (dob, date10.) as dob - and that errors out with a Conversion Failed when converting date and /or time from character string.&lt;BR /&gt;
Same thing with time fields  - I tried put (collecttime, time8.) as time&lt;BR /&gt;
The data in SAS are formatted as Number 5 YYMMDDN8&lt;BR /&gt;
and Number 5 Time8.&lt;BR /&gt;
The data I want in SQL Server 2008 would be a time(7) for the times and date for the dates. &lt;BR /&gt;
&lt;BR /&gt;
Any recommendations?</description>
      <pubDate>Mon, 07 Jun 2010 14:42:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Data-types-moving-data-to-SQL-Server/m-p/32342#M7775</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-06-07T14:42:10Z</dc:date>
    </item>
    <item>
      <title>Re: Data types - moving data to SQL Server</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Data-types-moving-data-to-SQL-Server/m-p/32343#M7776</link>
      <description>To work around your issue, I would convert the sas dates to sas datetime using the dhms function and datetime21.2 format.  Insert the new datetime field into SQL Server.  Then use the SQL update statement to parse out the date from the time in SQL Server.  This would be a pain but it should work.</description>
      <pubDate>Mon, 07 Jun 2010 15:04:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Data-types-moving-data-to-SQL-Server/m-p/32343#M7776</guid>
      <dc:creator>darrylovia</dc:creator>
      <dc:date>2010-06-07T15:04:38Z</dc:date>
    </item>
    <item>
      <title>Re: Data types - moving data to SQL Server</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Data-types-moving-data-to-SQL-Server/m-p/32344#M7777</link>
      <description>I ended up doing a really crappy case statement:&lt;BR /&gt;
case when dob &amp;lt;&amp;gt;. then put(dob, mmddyy10.) end as dob &lt;BR /&gt;
this is really crappy syntax, but works!&lt;BR /&gt;
&lt;BR /&gt;
Does anyone know how to do a Ltrim(rtrim(  )) to get rid of extra spaces?</description>
      <pubDate>Tue, 08 Jun 2010 14:48:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Data-types-moving-data-to-SQL-Server/m-p/32344#M7777</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-06-08T14:48:27Z</dc:date>
    </item>
    <item>
      <title>Re: Data types - moving data to SQL Server</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Data-types-moving-data-to-SQL-Server/m-p/32345#M7778</link>
      <description>TRIM(LEFT( YOUR_STRING ))</description>
      <pubDate>Wed, 09 Jun 2010 16:32:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Data-types-moving-data-to-SQL-Server/m-p/32345#M7778</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2010-06-09T16:32:49Z</dc:date>
    </item>
    <item>
      <title>Re: Data types - moving data to SQL Server</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Data-types-moving-data-to-SQL-Server/m-p/32346#M7779</link>
      <description>see the STRIP function strip(mystring)</description>
      <pubDate>Wed, 09 Jun 2010 17:23:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Data-types-moving-data-to-SQL-Server/m-p/32346#M7779</guid>
      <dc:creator>darrylovia</dc:creator>
      <dc:date>2010-06-09T17:23:32Z</dc:date>
    </item>
  </channel>
</rss>

