<?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: How do I get ODS Excel to output a date field? in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-do-I-get-ODS-Excel-to-output-a-date-field/m-p/422884#M20075</link>
    <description>I thought SAS treated dates as numeric and there is no date datatype. Shouldn't it really be date or datetime informats because that's how this numeric value is represented?</description>
    <pubDate>Wed, 20 Dec 2017 21:10:07 GMT</pubDate>
    <dc:creator>tomcmacdonald</dc:creator>
    <dc:date>2017-12-20T21:10:07Z</dc:date>
    <item>
      <title>How do I get ODS Excel to output a date field?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-do-I-get-ODS-Excel-to-output-a-date-field/m-p/422871#M20072</link>
      <description>&lt;P&gt;SAS code looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data foo;
    input id a date10.;
    datalines;
1 '1Jan2017'd
2 '2Jan2017'd
3 '1Jan2006'd
4 '31Dec2006'd
;
run;

ods excel file=&amp;amp;file;

proc print data=foo noobs;
  var a / style(data)={tagattr='type:DateTime'};
run;

ods excel close;&lt;/PRE&gt;&lt;P&gt;In the Excel file field a is treated as a string instead of a date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Dec 2017 20:47:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-do-I-get-ODS-Excel-to-output-a-date-field/m-p/422871#M20072</guid>
      <dc:creator>tomcmacdonald</dc:creator>
      <dc:date>2017-12-20T20:47:18Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get ODS Excel to output a date field?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-do-I-get-ODS-Excel-to-output-a-date-field/m-p/422874#M20073</link>
      <description>&lt;P&gt;Apply a format to the date. It currently doesn't have one assigned, even in the SAS data set it looks like a numeric value.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Dec 2017 20:57:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-do-I-get-ODS-Excel-to-output-a-date-field/m-p/422874#M20073</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-12-20T20:57:14Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get ODS Excel to output a date field?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-do-I-get-ODS-Excel-to-output-a-date-field/m-p/422881#M20074</link>
      <description>&lt;P&gt;Huh? First thing is to make it look like a date to SAS before sending it to Excel.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data foo;
  input id a date9.;
  format a date9. ;
datalines;
1 01Jan2017
2 02Jan2017
3 01Jan2006
4 31Dec2006
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now try exporting using PROC PRINT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods excel file="&amp;amp;path/test_date.xlsx";

proc print data=foo noobs;
run;

ods excel close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Looks fine to me.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 144px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/17449i1E7FA19F38F3EE39/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Dec 2017 20:59:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-do-I-get-ODS-Excel-to-output-a-date-field/m-p/422881#M20074</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-12-20T20:59:57Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get ODS Excel to output a date field?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-do-I-get-ODS-Excel-to-output-a-date-field/m-p/422884#M20075</link>
      <description>I thought SAS treated dates as numeric and there is no date datatype. Shouldn't it really be date or datetime informats because that's how this numeric value is represented?</description>
      <pubDate>Wed, 20 Dec 2017 21:10:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-do-I-get-ODS-Excel-to-output-a-date-field/m-p/422884#M20075</guid>
      <dc:creator>tomcmacdonald</dc:creator>
      <dc:date>2017-12-20T21:10:07Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get ODS Excel to output a date field?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-do-I-get-ODS-Excel-to-output-a-date-field/m-p/422886#M20076</link>
      <description>&lt;P&gt;INFORMATS control how SAS reads in a variable.&lt;/P&gt;
&lt;P&gt;FORMATS control how SAS displays a variable.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is no date data type, but there are date formats, a numeric variable with a date format will be treated as a date in Excel. If you want Excel to recognize it as a date use the mmddyy10. format.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/142145"&gt;@tomcmacdonald&lt;/a&gt; wrote:&lt;BR /&gt;I thought SAS treated dates as numeric and there is no date datatype. Shouldn't it really be date or datetime informats because that's how this numeric value is represented?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Dec 2017 21:12:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-do-I-get-ODS-Excel-to-output-a-date-field/m-p/422886#M20076</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-12-20T21:12:10Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get ODS Excel to output a date field?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-do-I-get-ODS-Excel-to-output-a-date-field/m-p/422887#M20077</link>
      <description>OK, thank you.</description>
      <pubDate>Wed, 20 Dec 2017 21:13:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-do-I-get-ODS-Excel-to-output-a-date-field/m-p/422887#M20077</guid>
      <dc:creator>tomcmacdonald</dc:creator>
      <dc:date>2017-12-20T21:13:21Z</dc:date>
    </item>
  </channel>
</rss>

