<?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: convert excel dates to numbers in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/convert-excel-dates-to-numbers/m-p/289396#M59765</link>
    <description>&lt;P&gt;Is the variable that you have in SAS numeric or character when you read the data? If numeric then all the character stuff is likely gone.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suspect that easiest would be to go back to Excel. Make sure the date column(s) are formatted as dates.&lt;/P&gt;
&lt;P&gt;Do a file&amp;gt;save as&amp;gt; to a CSV file. Then use proc import or the import wizard&amp;nbsp;to read the data. The the GUESSINROWS value to either 32000 or the number of rows in the file, which ever is smaller.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You have a much better chance of getting the values you want and as dates.&lt;/P&gt;</description>
    <pubDate>Wed, 03 Aug 2016 23:38:11 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2016-08-03T23:38:11Z</dc:date>
    <item>
      <title>convert excel dates to numbers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-excel-dates-to-numbers/m-p/289382#M59763</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am having a problem with a variable that is has two different formats in excel, number and date.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried the following piece of code which helped me before with a problem i had&lt;/P&gt;&lt;P&gt;(Source: &lt;A href="https://communities.sas.com/t5/Base-SAS-Programming/convert-variable-of-Char-and-numeric-to-date/m-p/283874#M57885" target="_blank"&gt;https://communities.sas.com/t5/Base-SAS-Programming/convert-variable-of-Char-and-numeric-to-date/m-p/283874#M57885&lt;/A&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if index(num(k),'/') &amp;gt;0 then num_form(k)=input(num(k), mmddyy10.);&lt;BR /&gt;else if num(k)~='missing' then num_form(k)= input(num(k), 8.);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i was planning to convert to a date then back to a number but it didnt work which you can see in the image i attached. i have also tried&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if index(num(k),'/') &amp;gt;0 then num_form(k)=input(num(k), 8..);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;else if num(k)~='missing' then num_form(k)= input(num(k), 8.);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;which leaves me with blanks where the dates were.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;can someone please help??&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/12827i40A291C1FFC20C02/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="sas_prob.PNG" title="sas_prob.PNG" /&gt;</description>
      <pubDate>Wed, 03 Aug 2016 22:24:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-excel-dates-to-numbers/m-p/289382#M59763</guid>
      <dc:creator>jcurran1289</dc:creator>
      <dc:date>2016-08-03T22:24:15Z</dc:date>
    </item>
    <item>
      <title>Re: convert excel dates to numbers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-excel-dates-to-numbers/m-p/289396#M59765</link>
      <description>&lt;P&gt;Is the variable that you have in SAS numeric or character when you read the data? If numeric then all the character stuff is likely gone.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suspect that easiest would be to go back to Excel. Make sure the date column(s) are formatted as dates.&lt;/P&gt;
&lt;P&gt;Do a file&amp;gt;save as&amp;gt; to a CSV file. Then use proc import or the import wizard&amp;nbsp;to read the data. The the GUESSINROWS value to either 32000 or the number of rows in the file, which ever is smaller.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You have a much better chance of getting the values you want and as dates.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Aug 2016 23:38:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-excel-dates-to-numbers/m-p/289396#M59765</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-08-03T23:38:11Z</dc:date>
    </item>
    <item>
      <title>Re: convert excel dates to numbers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-excel-dates-to-numbers/m-p/289425#M59771</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Excel consider 1Jan1900 as 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;SAS &amp;nbsp;consider 1Jan1960 as 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So while converting date to number make use of following formula&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;SAS_date_time = (Excel_date_time - 21916)&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2016 03:40:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-excel-dates-to-numbers/m-p/289425#M59771</guid>
      <dc:creator>RahulG</dc:creator>
      <dc:date>2016-08-04T03:40:27Z</dc:date>
    </item>
    <item>
      <title>Re: convert excel dates to numbers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/convert-excel-dates-to-numbers/m-p/289435#M59779</link>
      <description>&lt;P&gt;Actually, the zero day in SAS is 01jan1960, while the zero day in Excel is really 30dec1899.&lt;/P&gt;
&lt;P&gt;Excel displays the value 1 as 01jan1900, but this is wrong, as Excel (current version 2010) still considers 1900 to be a leap year (with a February 29 that never existed), a bug that is fixed in other office suites. This is also the reason why Excel can't work with negative values as dates, in contrast to LibreOffice et al.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2016 05:48:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/convert-excel-dates-to-numbers/m-p/289435#M59779</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-08-04T05:48:09Z</dc:date>
    </item>
  </channel>
</rss>

