<?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: ODS Excel maintaining date time formatting when missing values in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-Excel-maintaining-date-time-formatting-when-missing-values/m-p/473753#M21186</link>
    <description>&lt;P&gt;This is awesome!!&amp;nbsp; I don't understand yet how it's working but it IS working &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp; Thank you so much.&lt;/P&gt;</description>
    <pubDate>Wed, 27 Jun 2018 14:30:12 GMT</pubDate>
    <dc:creator>jlr337</dc:creator>
    <dc:date>2018-06-27T14:30:12Z</dc:date>
    <item>
      <title>ODS Excel maintaining date time formatting when missing values</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-Excel-maintaining-date-time-formatting-when-missing-values/m-p/472211#M21130</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;I am using ODS excel and it is working great except for one formatting issue.&amp;nbsp; I have date and time fields that format correctly in excel when there is a value, but the formatting is not the same&amp;nbsp;if the cells are blank.&amp;nbsp; This is causing a problem/extra step for the end user.&amp;nbsp; The user wants to enter data after review into the empty cells.&amp;nbsp; Below&amp;nbsp;is an example. The first row had values and exported from sas correctly using proc report/ods excel. I entered the same values in the second row directly in Excel.&amp;nbsp; The formats should be mmddyy10 and hh:mm for all cells&amp;nbsp;&lt;/P&gt;&lt;P&gt;Users can modify the cells using number format in excel but I would like to be able to eliminate that step.&lt;/P&gt;&lt;P&gt;The formatting is maintained when using ods tagset.excelxp regardless of value or not but I'm trying to get away from using&amp;nbsp;this because&amp;nbsp;it require either me or the end user to have an added step of re-saving the file as .xlsx since the output is in .xml. (I get warnings when I open &amp;amp; modify an .xml document so I always re-save as .xlsx before sending to users-&amp;nbsp; I'm sure my end users would be annoyed by all warning messages if it was sent as is)&amp;nbsp; I'm trying to make the process as efficient, convenient as possible&amp;nbsp;so&amp;nbsp;I'm open to any suggestions &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ods excel output formatting issue 06.21.2018.png" style="width: 430px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/21315i7CFB7083BD45EB86/image-size/large?v=v2&amp;amp;px=999" role="button" title="ods excel output formatting issue 06.21.2018.png" alt="ods excel output formatting issue 06.21.2018.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my program I have tried to format the variables in the proc sql step as well as in the define column portion of the proc report but neither maintains the formatting.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example code:&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table pt_list_dtl as&lt;BR /&gt;select&lt;/P&gt;&lt;P&gt;a.HSP_ACCOUNT_ID&lt;/P&gt;&lt;P&gt;,a.pt_name_mrn&lt;BR /&gt;,b.cdate format mmddyy10.&lt;BR /&gt;,b.ctime format hhmm.&lt;BR /&gt;from ...&lt;BR /&gt;where...&lt;BR /&gt;;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;options missing=' ';&amp;nbsp;&lt;/P&gt;&lt;P&gt;ods listing close;&lt;/P&gt;&lt;P&gt;ods excel file='...xlsx';&lt;/P&gt;&lt;P&gt;ods excel&lt;/P&gt;&lt;P&gt;options (...);&lt;/P&gt;&lt;P&gt;proc report data=pt_list_dtl;&lt;BR /&gt;where pt_name_mrn in (&amp;amp;pat);&lt;BR /&gt;column cdate ctime;&lt;BR /&gt;define cdate/display 'Date Collected' format=mmddyy10. style(column)={cellwidth=1.5in};&lt;BR /&gt;define ctime/display 'Time Collected' format=hhmm. style(column)={cellwidth=2in};&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;I'm currently using:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sas eg version 06.21.2018.png" style="width: 433px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/21316i1536EB23363728CB/image-size/large?v=v2&amp;amp;px=999" role="button" title="sas eg version 06.21.2018.png" alt="sas eg version 06.21.2018.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jun 2018 16:59:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-Excel-maintaining-date-time-formatting-when-missing-values/m-p/472211#M21130</guid>
      <dc:creator>jlr337</dc:creator>
      <dc:date>2018-06-21T16:59:31Z</dc:date>
    </item>
    <item>
      <title>Re: ODS Excel maintaining date time formatting when missing values</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-Excel-maintaining-date-time-formatting-when-missing-values/m-p/472756#M21145</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/182477"&gt;@jlr337&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Below code should apply a constant cell format within the range of your output.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sample(drop=_:);
  length cdate ctime 8;
  _cdate=today();
  _ctime=time();
  do _i=1 to 5;
    cdate=_cdate+_i;
    ctime=_ctime+50*_i;
    if _i=3 then call missing(cdate, ctime);
    output;
  end;
  stop;
run;

options missing=' ';
ods listing close;
ods excel file='c:\temp\test.xlsx';
ods excel options(index='on' SHEET_NAME='text-string');
proc report data=sample;
  column cdate ctime;
  define cdate/display 'Date Collected' format=mmddyy10. style(column)={cellwidth=1.5in tagattr='format: mm/dd/yyyy'};
  define ctime/display 'Time Collected' format=hhmm.     style(column)={cellwidth=2in tagattr='format: hh:mm'};
run;
ods excel close;
ods listing;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 24 Jun 2018 04:34:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-Excel-maintaining-date-time-formatting-when-missing-values/m-p/472756#M21145</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-06-24T04:34:05Z</dc:date>
    </item>
    <item>
      <title>Re: ODS Excel maintaining date time formatting when missing values</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-Excel-maintaining-date-time-formatting-when-missing-values/m-p/473753#M21186</link>
      <description>&lt;P&gt;This is awesome!!&amp;nbsp; I don't understand yet how it's working but it IS working &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp; Thank you so much.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jun 2018 14:30:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-Excel-maintaining-date-time-formatting-when-missing-values/m-p/473753#M21186</guid>
      <dc:creator>jlr337</dc:creator>
      <dc:date>2018-06-27T14:30:12Z</dc:date>
    </item>
  </channel>
</rss>

