<?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 Achieve the default Excel style with proc template and ods excel in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Achieve-the-default-Excel-style-with-proc-template-and-ods-excel/m-p/937785#M26679</link>
    <description>&lt;P&gt;Hi, I'm trying to replicate the default plain style in Excel by using proc template and ods excel.&lt;/P&gt;&lt;P&gt;Let's see an example to understand what I'd like to generate using SAS.&lt;/P&gt;&lt;P&gt;As you can see from the image below, it is the default style when manually creating an excel file. Basically, this style can be summarized by the following features:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;transparent background color&lt;/LI&gt;&lt;LI&gt;black text color&lt;/LI&gt;&lt;LI&gt;Calibri font with 11pt size and left alignment&lt;/LI&gt;&lt;LI&gt;20 px row height and 64 pixels column width&lt;/LI&gt;&lt;LI&gt;no wrap text, i.e. the text inside cells must not be wrapped into multiple lines&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Rabelais_0-1722438768173.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/98877iC7368ACEF42DB2D8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Rabelais_0-1722438768173.png" alt="Rabelais_0-1722438768173.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what I obtain with the code below&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Rabelais_5-1722440403109.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/98882iF0E334D4C59B9E86/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Rabelais_5-1722440403109.png" alt="Rabelais_5-1722440403109.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data test;
test=123;
description="lorem ipsum dolor sit amet consectetur adipiscing elit sed do eiusmod tempor incididunt";
status="pass";
output;
run;

proc template;
define style styles.excel_update;
parent=styles.excel;
class body, header, data / fontfamily=Calibri fontsize=11pt just=left color=black fontweight=medium
	backgroundcolor=_undef_ nobreakspace=on asis=off cellpadding=0 cellspacing=0 height=20 CELLWIDTH=64
/*	tagattr="wrap:no"*/
;
end;
run;

ods excel
	file="your_path\test.xlsx"
	style=styles.excel_update 
/*	options(*/
/*		flow="tables"*/
/*		absolute_Column_Width="64px"*/
/*		absolute_row_height="20px"*/
/*	)*/
;

proc report data=test;
	columns _ALL_;
run;

ods excel close;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you can see, features 4 and 5 are not achieved. In particular, notice that the colums width is 54 pixels instead of 64, and the row height of the rows below the table is 18 pixels instead of 20. Moreover, the text not only is wrapped into multiple lines, but&amp;nbsp;&lt;SPAN&gt;line breaks are added after each word.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;By uncommenting the lines&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;/*	options(*/
/*		flow="tables"*/
/*		absolute_Column_Width="64px"*/
/*		absolute_row_height="20px"*/
/*	)*/&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I obtain the following result, which is very good, but has minor flaws:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;the row height of the rows below the table is 18 pixels instead of 20&lt;/LI&gt;&lt;LI&gt;line breaks are not added to text (thanks to &lt;CODE class=""&gt;flow="tables"&lt;/CODE&gt;) but wrap is still active (I tried also by uncommenting&amp;nbsp;&lt;CODE class=""&gt;tagattr="wrap:no"&lt;/CODE&gt;&amp;nbsp;but nothing happens)&lt;/LI&gt;&lt;LI&gt;the number 123 is displayed at the center of the cell, this is because what the cell actually contains is&amp;nbsp; "&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;123" instead of the number 123 (EDIT: this is caused by &lt;CODE class=""&gt;height=20 CELLWIDTH=64&lt;/CODE&gt;)&lt;/LI&gt;&lt;/UL&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="Rabelais_6-1722440659301.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/98883i9551BB960EA447FF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Rabelais_6-1722440659301.png" alt="Rabelais_6-1722440659301.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Question 1: why&amp;nbsp;&lt;CODE class=""&gt;nobreakspace=on asis=off&lt;/CODE&gt; don't work? In the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/odsproc/p1pt77toue3iyun0z4l9gth5as9f.htm#p1u6te2euj2gtan16gchixhcucmw" target="_self"&gt;documentation&lt;/A&gt; I read that &lt;STRONG&gt;ASIS=OFF&lt;/STRONG&gt; trims leading spaces and ignores line breaks, and that&amp;nbsp;&lt;STRONG&gt;NOBREAKSPACE=ON&lt;/STRONG&gt; does not let SAS break a line at a space character. So why in the second screenshot we see that lines are broken and that line breaks are not ignored?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Question 2: is it possible to achieve the desired result &lt;STRONG&gt;without using ods excel options&lt;/STRONG&gt;, but just by using &lt;STRONG&gt;proc template&lt;/STRONG&gt; style attributes?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Question 3: if the answer to Question 2 is "no", &lt;STRONG&gt;why&lt;/STRONG&gt; do the three flaws described above happen and&amp;nbsp;&lt;STRONG&gt;how to solve&lt;/STRONG&gt; them?&lt;/P&gt;</description>
    <pubDate>Wed, 31 Jul 2024 16:27:39 GMT</pubDate>
    <dc:creator>Rabelais</dc:creator>
    <dc:date>2024-07-31T16:27:39Z</dc:date>
    <item>
      <title>Achieve the default Excel style with proc template and ods excel</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Achieve-the-default-Excel-style-with-proc-template-and-ods-excel/m-p/937785#M26679</link>
      <description>&lt;P&gt;Hi, I'm trying to replicate the default plain style in Excel by using proc template and ods excel.&lt;/P&gt;&lt;P&gt;Let's see an example to understand what I'd like to generate using SAS.&lt;/P&gt;&lt;P&gt;As you can see from the image below, it is the default style when manually creating an excel file. Basically, this style can be summarized by the following features:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;transparent background color&lt;/LI&gt;&lt;LI&gt;black text color&lt;/LI&gt;&lt;LI&gt;Calibri font with 11pt size and left alignment&lt;/LI&gt;&lt;LI&gt;20 px row height and 64 pixels column width&lt;/LI&gt;&lt;LI&gt;no wrap text, i.e. the text inside cells must not be wrapped into multiple lines&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Rabelais_0-1722438768173.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/98877iC7368ACEF42DB2D8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Rabelais_0-1722438768173.png" alt="Rabelais_0-1722438768173.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what I obtain with the code below&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Rabelais_5-1722440403109.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/98882iF0E334D4C59B9E86/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Rabelais_5-1722440403109.png" alt="Rabelais_5-1722440403109.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data test;
test=123;
description="lorem ipsum dolor sit amet consectetur adipiscing elit sed do eiusmod tempor incididunt";
status="pass";
output;
run;

proc template;
define style styles.excel_update;
parent=styles.excel;
class body, header, data / fontfamily=Calibri fontsize=11pt just=left color=black fontweight=medium
	backgroundcolor=_undef_ nobreakspace=on asis=off cellpadding=0 cellspacing=0 height=20 CELLWIDTH=64
/*	tagattr="wrap:no"*/
;
end;
run;

ods excel
	file="your_path\test.xlsx"
	style=styles.excel_update 
/*	options(*/
/*		flow="tables"*/
/*		absolute_Column_Width="64px"*/
/*		absolute_row_height="20px"*/
/*	)*/
;

proc report data=test;
	columns _ALL_;
run;

ods excel close;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you can see, features 4 and 5 are not achieved. In particular, notice that the colums width is 54 pixels instead of 64, and the row height of the rows below the table is 18 pixels instead of 20. Moreover, the text not only is wrapped into multiple lines, but&amp;nbsp;&lt;SPAN&gt;line breaks are added after each word.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;By uncommenting the lines&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;/*	options(*/
/*		flow="tables"*/
/*		absolute_Column_Width="64px"*/
/*		absolute_row_height="20px"*/
/*	)*/&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I obtain the following result, which is very good, but has minor flaws:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;the row height of the rows below the table is 18 pixels instead of 20&lt;/LI&gt;&lt;LI&gt;line breaks are not added to text (thanks to &lt;CODE class=""&gt;flow="tables"&lt;/CODE&gt;) but wrap is still active (I tried also by uncommenting&amp;nbsp;&lt;CODE class=""&gt;tagattr="wrap:no"&lt;/CODE&gt;&amp;nbsp;but nothing happens)&lt;/LI&gt;&lt;LI&gt;the number 123 is displayed at the center of the cell, this is because what the cell actually contains is&amp;nbsp; "&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;123" instead of the number 123 (EDIT: this is caused by &lt;CODE class=""&gt;height=20 CELLWIDTH=64&lt;/CODE&gt;)&lt;/LI&gt;&lt;/UL&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="Rabelais_6-1722440659301.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/98883i9551BB960EA447FF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Rabelais_6-1722440659301.png" alt="Rabelais_6-1722440659301.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Question 1: why&amp;nbsp;&lt;CODE class=""&gt;nobreakspace=on asis=off&lt;/CODE&gt; don't work? In the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/odsproc/p1pt77toue3iyun0z4l9gth5as9f.htm#p1u6te2euj2gtan16gchixhcucmw" target="_self"&gt;documentation&lt;/A&gt; I read that &lt;STRONG&gt;ASIS=OFF&lt;/STRONG&gt; trims leading spaces and ignores line breaks, and that&amp;nbsp;&lt;STRONG&gt;NOBREAKSPACE=ON&lt;/STRONG&gt; does not let SAS break a line at a space character. So why in the second screenshot we see that lines are broken and that line breaks are not ignored?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Question 2: is it possible to achieve the desired result &lt;STRONG&gt;without using ods excel options&lt;/STRONG&gt;, but just by using &lt;STRONG&gt;proc template&lt;/STRONG&gt; style attributes?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Question 3: if the answer to Question 2 is "no", &lt;STRONG&gt;why&lt;/STRONG&gt; do the three flaws described above happen and&amp;nbsp;&lt;STRONG&gt;how to solve&lt;/STRONG&gt; them?&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2024 16:27:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Achieve-the-default-Excel-style-with-proc-template-and-ods-excel/m-p/937785#M26679</guid>
      <dc:creator>Rabelais</dc:creator>
      <dc:date>2024-07-31T16:27:39Z</dc:date>
    </item>
  </channel>
</rss>

