<?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: Importing CSV tables with dates in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Importing-CSV-tables-with-dates/m-p/150763#M39723</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333330154419px; background-color: #ffffff;"&gt;Ballardw said:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333330154419px; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333330154419px; background-color: #ffffff;"&gt;BTW, if this file comes from an Excel file exported to CSV you may have a mix of dates like 07/21/2014 and 48756 where the second are the native Excel date value. Which SAS cannot tell are dates or get pretty flaky on read.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333330154419px; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333330154419px; background-color: #ffffff;"&gt;You are correct the data comes from EXCEL I convert to CSV before exporting into SAS.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333330154419px; background-color: #ffffff;"&gt;That is correct I think the 48756 dates are the main culprits as they appear different on SAS thus cannot be read correctly.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333330154419px; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333330154419px; background-color: #ffffff;"&gt;What is the remedy?&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 30 Oct 2014 21:46:49 GMT</pubDate>
    <dc:creator>menhtp</dc:creator>
    <dc:date>2014-10-30T21:46:49Z</dc:date>
    <item>
      <title>Importing CSV tables with dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Importing-CSV-tables-with-dates/m-p/150761#M39721</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to import&amp;nbsp; CSV file with dates . Looks like when I do that some dates are not read correctly in SAS. I suspect the reason &lt;/P&gt;&lt;P&gt;is that some of the dates within csv are in a format e.g text that SAS cannot convert correctly to a sas date. To remedy this, i have read&lt;/P&gt;&lt;P&gt;a document somewhere that using the following expression when importing:&lt;/P&gt;&lt;P&gt;Libname..&lt;/P&gt;&lt;P&gt;Mixed=yes&lt;/P&gt;&lt;P&gt;stringdates=yes&lt;/P&gt;&lt;P&gt;scantime=yes; &lt;/P&gt;&lt;P&gt;and then adding a statement like this &lt;/P&gt;&lt;P&gt;data sheet29 ( drop= datevar)&lt;/P&gt;&lt;P&gt;format datevar date9.;&lt;/P&gt;&lt;P&gt;set .......(rename=(datevar=_datevar)))&lt;/P&gt;&lt;P&gt;_datevar=input ( datevar, mmdyy10.);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;Libname .... clear&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is how do i integrate this statement with my proc import, which looks like this: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;PROC IMPORT OUT= WORK..... DATAFILE= "C.....&lt;BR /&gt;&amp;nbsp; DBMS=..... REPLACE;&lt;BR /&gt;...............&lt;BR /&gt;&amp;nbsp; GETNAMES=YES;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run:&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Thanks.&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Oct 2014 19:44:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Importing-CSV-tables-with-dates/m-p/150761#M39721</guid>
      <dc:creator>menhtp</dc:creator>
      <dc:date>2014-10-30T19:44:59Z</dc:date>
    </item>
    <item>
      <title>Re: Importing CSV tables with dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Importing-CSV-tables-with-dates/m-p/150762#M39722</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Show some of the example data.&lt;/P&gt;&lt;P&gt;Also look in the log after running proc import. There should be code that shows exactly how SAS tried to read the variable in a statement like INFORMAT Datevaraibe xxxxxx.; What format shows where I have the XXXXX?&lt;/P&gt;&lt;P&gt;You may want to increase the guessingrows option for how much of the data to examine when importing to decide what the informat is used.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BTW, if this file comes from an Excel file exported to CSV you may have a mix of dates like 07/21/2014 and 48756 where the second are the native Excel date value. Which SAS cannot tell are dates or get pretty flaky on read.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Oct 2014 20:34:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Importing-CSV-tables-with-dates/m-p/150762#M39722</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-10-30T20:34:53Z</dc:date>
    </item>
    <item>
      <title>Re: Importing CSV tables with dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Importing-CSV-tables-with-dates/m-p/150763#M39723</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333330154419px; background-color: #ffffff;"&gt;Ballardw said:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333330154419px; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333330154419px; background-color: #ffffff;"&gt;BTW, if this file comes from an Excel file exported to CSV you may have a mix of dates like 07/21/2014 and 48756 where the second are the native Excel date value. Which SAS cannot tell are dates or get pretty flaky on read.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333330154419px; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333330154419px; background-color: #ffffff;"&gt;You are correct the data comes from EXCEL I convert to CSV before exporting into SAS.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333330154419px; background-color: #ffffff;"&gt;That is correct I think the 48756 dates are the main culprits as they appear different on SAS thus cannot be read correctly.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333330154419px; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333330154419px; background-color: #ffffff;"&gt;What is the remedy?&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Oct 2014 21:46:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Importing-CSV-tables-with-dates/m-p/150763#M39723</guid>
      <dc:creator>menhtp</dc:creator>
      <dc:date>2014-10-30T21:46:49Z</dc:date>
    </item>
    <item>
      <title>Re: Importing CSV tables with dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Importing-CSV-tables-with-dates/m-p/150764#M39724</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In Excel highlight the entire column and the apply the date format to all the cells. Repeat for other date columns. Then do the file-save-as to CSV.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I suspect some folks may have written a VB script to accomplish the cell formatting but I'm not a VB programmer except in desperation.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Oct 2014 22:06:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Importing-CSV-tables-with-dates/m-p/150764#M39724</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-10-30T22:06:43Z</dc:date>
    </item>
  </channel>
</rss>

