<?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 Proc Import a Date Column in EXCEL as a Date in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Proc-Import-a-Date-Column-in-EXCEL-as-a-Date/m-p/712570#M27066</link>
    <description>&lt;P&gt;I imported an excel datasheet using proc import and one of the date columns came in as a character variable with numbers populated. Is there anyway to modify the proc import so that the date data comes in as it should? MM/DD/YYYY? I know this is happening because some values are stored as year only and some are blank.&lt;/P&gt;</description>
    <pubDate>Wed, 20 Jan 2021 02:38:58 GMT</pubDate>
    <dc:creator>InspectahDex</dc:creator>
    <dc:date>2021-01-20T02:38:58Z</dc:date>
    <item>
      <title>Proc Import a Date Column in EXCEL as a Date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Proc-Import-a-Date-Column-in-EXCEL-as-a-Date/m-p/712570#M27066</link>
      <description>&lt;P&gt;I imported an excel datasheet using proc import and one of the date columns came in as a character variable with numbers populated. Is there anyway to modify the proc import so that the date data comes in as it should? MM/DD/YYYY? I know this is happening because some values are stored as year only and some are blank.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2021 02:38:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Proc-Import-a-Date-Column-in-EXCEL-as-a-Date/m-p/712570#M27066</guid>
      <dc:creator>InspectahDex</dc:creator>
      <dc:date>2021-01-20T02:38:58Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Import a Date Column in EXCEL as a Date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Proc-Import-a-Date-Column-in-EXCEL-as-a-Date/m-p/712584#M27067</link>
      <description>No, and it wouldn't correctly handle the cases where you have a year only. &lt;BR /&gt;If you can read it in from a text file you can control the format, but not Excel. &lt;BR /&gt;&lt;BR /&gt;You can use INPUT to convert the dates that are full dates but you'll need to handle the years only or missing separately. &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;if length(date) = 10 then new_date = input(date, mmddyy10.);&lt;BR /&gt;else if length(date)=4 then new_date = mdy(7, 1, input(date, 4.));&lt;BR /&gt;else if missing(date) then new_date = .;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 20 Jan 2021 04:17:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Proc-Import-a-Date-Column-in-EXCEL-as-a-Date/m-p/712584#M27067</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-01-20T04:17:11Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Import a Date Column in EXCEL as a Date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Proc-Import-a-Date-Column-in-EXCEL-as-a-Date/m-p/712588#M27068</link>
      <description>&lt;P&gt;A variable only has one type, unlike a spreadsheet in a dataset you cannot mix numbers and character strings.&amp;nbsp; If the column has some cells with dates (numbers) and some with strings then SAS will be forced to create the variable as character. When it does that the values of cells that contain date values are stored as the string of digits that represent the number Excel stores for that date.&amp;nbsp; So the date 01JAN2021 will show up as the string '44197' instead of either '01JAN2021' or the number&amp;nbsp;22,281 that SAS would use to represent that date.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The best solution is to fix the column in the spreadsheet so that every value is a string.&amp;nbsp; Then what you have in SAS will be the string.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2021 04:36:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Proc-Import-a-Date-Column-in-EXCEL-as-a-Date/m-p/712588#M27068</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-01-20T04:36:05Z</dc:date>
    </item>
  </channel>
</rss>

