<?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 How to compress letter in date column when import Excel file to SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-compress-letter-in-date-column-when-import-Excel-file-to/m-p/545679#M151009</link>
    <description>&lt;P&gt;Hello Everyone,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have an Excel file attached where in column date (mm/dd/yyyy) there is cell like ?02/20/2019 or 1/1/2019!&lt;/P&gt;
&lt;P&gt;Thus when I do proc import, the whole date column turn to text.&lt;/P&gt;
&lt;P&gt;Is there anyway to compress these character and&amp;nbsp; import the file correctly?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HHCFX&lt;/P&gt;</description>
    <pubDate>Mon, 25 Mar 2019 02:57:49 GMT</pubDate>
    <dc:creator>hhchenfx</dc:creator>
    <dc:date>2019-03-25T02:57:49Z</dc:date>
    <item>
      <title>How to compress letter in date column when import Excel file to SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compress-letter-in-date-column-when-import-Excel-file-to/m-p/545679#M151009</link>
      <description>&lt;P&gt;Hello Everyone,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have an Excel file attached where in column date (mm/dd/yyyy) there is cell like ?02/20/2019 or 1/1/2019!&lt;/P&gt;
&lt;P&gt;Thus when I do proc import, the whole date column turn to text.&lt;/P&gt;
&lt;P&gt;Is there anyway to compress these character and&amp;nbsp; import the file correctly?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HHCFX&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2019 02:57:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compress-letter-in-date-column-when-import-Excel-file-to/m-p/545679#M151009</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2019-03-25T02:57:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to compress letter in date column when import Excel file to SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compress-letter-in-date-column-when-import-Excel-file-to/m-p/545685#M151013</link>
      <description>&lt;P&gt;Yes. Open the file in Excel and fix the column so that only contains dates.&amp;nbsp; Or convert the column so that it only contains strings that look like dates that you can then convert after importing.&amp;nbsp; Or save the file to a text file (like a CSV file) and write your own data step to read it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or better still don't use Excel for data entry at all.&amp;nbsp; It is not really suited to use for a database or date entry tool.&amp;nbsp; It was designed for doing spreadsheet type calculations where each cell is independent.&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you really have to deal with a column that has mixed dates and text then you will find that the actual dates will appears a digit strings that represent the way that Excel counts days.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have ;
  if 3 &amp;lt; length(chardate) &amp;lt;= 5 and not missing(input(chardate,??5.) then
    numdate = input(chardate,5.) + '30DEC1899'd ;
  else numdate=input(compress(chardate,'?!'),mmddyy10.);
  format numdate yymmdd10.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 25 Mar 2019 04:55:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compress-letter-in-date-column-when-import-Excel-file-to/m-p/545685#M151013</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-03-25T04:55:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to compress letter in date column when import Excel file to SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compress-letter-in-date-column-when-import-Excel-file-to/m-p/545966#M151121</link>
      <description>&lt;P&gt;Thank you, Tom.&lt;/P&gt;
&lt;P&gt;Your code works with other cells but not the first one where :&amp;nbsp;*!9/20/2017&lt;/P&gt;
&lt;P&gt;Yes, I got to deal with that messy data.&lt;/P&gt;
&lt;P&gt;HHCFX&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2019 21:32:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compress-letter-in-date-column-when-import-Excel-file-to/m-p/545966#M151121</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2019-03-25T21:32:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to compress letter in date column when import Excel file to SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compress-letter-in-date-column-when-import-Excel-file-to/m-p/545973#M151125</link>
      <description>&lt;P&gt;Read up on the features of the COMPRESS() function.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ;
  input chardate $20. ;
cards;
*!9/20/2017
;

data want;
  set have;
  numdate=input(compress(chardate,'-/.','kd'),mmddyy10.);
  format numdate yymmdd10.;
run;

proc print;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;Obs     chardate         numdate

 1     *!9/20/2017    2017-09-20

&lt;/PRE&gt;</description>
      <pubDate>Mon, 25 Mar 2019 22:15:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compress-letter-in-date-column-when-import-Excel-file-to/m-p/545973#M151125</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-03-25T22:15:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to compress letter in date column when import Excel file to SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compress-letter-in-date-column-when-import-Excel-file-to/m-p/547079#M151550</link>
      <description>&lt;P&gt;Thanks a lot, Tom.&lt;/P&gt;
&lt;P&gt;HHC&lt;/P&gt;</description>
      <pubDate>Fri, 29 Mar 2019 01:56:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compress-letter-in-date-column-when-import-Excel-file-to/m-p/547079#M151550</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2019-03-29T01:56:41Z</dc:date>
    </item>
  </channel>
</rss>

