<?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: columns' width is changed when exporting to excel (using proc report and ods excel) in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/columns-width-is-changed-when-exporting-to-excel-using-proc/m-p/937969#M26685</link>
    <description>Thanks, but absolute_column_width does set the same width to all columns, doesn't it?&lt;BR /&gt;&lt;BR /&gt;What if I need to set a different width to each column?</description>
    <pubDate>Thu, 01 Aug 2024 15:15:07 GMT</pubDate>
    <dc:creator>Rabelais</dc:creator>
    <dc:date>2024-08-01T15:15:07Z</dc:date>
    <item>
      <title>columns' width is changed when exporting to excel (using proc report and ods excel)</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/columns-width-is-changed-when-exporting-to-excel-using-proc/m-p/937889#M26682</link>
      <description>&lt;P&gt;I'm trying to set a specific width to each column in my report and I expect to find the same widths in the excel file created by ods excel, but when I open the file in excel the widths are changed (bigger)... why does this happen?&lt;/P&gt;&lt;P&gt;Let's see an example&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=""&gt;data test;
very_long_variable_name=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 header, body, data / fontfamily=Calibri fontsize=11pt color=black fontweight=medium backgroundcolor=_undef_ just=left;
end;
run;

ods excel
	file="your_path\test.xlsx"
	style=styles.excel_update 
	options(flow="tables" absolute_row_height="20px");

proc report
	data=test;
	columns _ALL_;
	define very_long_variable_name / style(column)={width=1.86in};
	define description	/ style(column)={width=6.26in};
	define status 		/ style(column)={width=0.48in};
run;

ods excel close;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;To choose the width values 1.86in, 6.26in and 0.48in I opened the excel file and used the "auto fit width" feature. Then by using the "Page Layout" view I can see the exact width inches of each column, as shown in the image below.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Rabelais_2-1722503139475.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/98911i4D014E1A199C514E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Rabelais_2-1722503139475.png" alt="Rabelais_2-1722503139475.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The following is a screenshot from the xlsx created by the previous code. As you can see the columns' width are larger.&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="Rabelais_0-1722502919004.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/98909i0E89ABF07AA5B59A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Rabelais_0-1722502919004.png" alt="Rabelais_0-1722502919004.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;for example the first column has a width of 2.35in, even if I set it to be equal to 1.86in (the other columns are 7.80in and 0.67in)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Rabelais_1-1722503069325.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/98910iAC54D9EF33F169DD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Rabelais_1-1722503069325.png" alt="Rabelais_1-1722503069325.png" /&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;Why the columns' width are changed? Is there a way in the SAS code to set the column' widths so that the excel file will have the same widths?&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2024 09:19:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/columns-width-is-changed-when-exporting-to-excel-using-proc/m-p/937889#M26682</guid>
      <dc:creator>Rabelais</dc:creator>
      <dc:date>2024-08-01T09:19:26Z</dc:date>
    </item>
    <item>
      <title>Re: columns' width is changed when exporting to excel (using proc report and ods excel)</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/columns-width-is-changed-when-exporting-to-excel-using-proc/m-p/937935#M26684</link>
      <description>&lt;P&gt;Use the absolute_column_width options instead of the Report procedure if you really need to control specific column widths. Any output sent to the sheet prior to Proc Report will set the column widths because of the way Excel does things. You can't have a column change widths (any apparent exception to this usually will have merged cells involved).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also providing a measurement in Pixels is somewhat problematic as there is no standard size for a "pixel", they are display dependent and one systems 20 pixels may be minuscule or gigantic on a different device. I would recommend using IN, CM or MM for units as those are human understandable in code and should work across devices.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2024 14:16:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/columns-width-is-changed-when-exporting-to-excel-using-proc/m-p/937935#M26684</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-08-01T14:16:17Z</dc:date>
    </item>
    <item>
      <title>Re: columns' width is changed when exporting to excel (using proc report and ods excel)</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/columns-width-is-changed-when-exporting-to-excel-using-proc/m-p/937969#M26685</link>
      <description>Thanks, but absolute_column_width does set the same width to all columns, doesn't it?&lt;BR /&gt;&lt;BR /&gt;What if I need to set a different width to each column?</description>
      <pubDate>Thu, 01 Aug 2024 15:15:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/columns-width-is-changed-when-exporting-to-excel-using-proc/m-p/937969#M26685</guid>
      <dc:creator>Rabelais</dc:creator>
      <dc:date>2024-08-01T15:15:07Z</dc:date>
    </item>
    <item>
      <title>Re: columns' width is changed when exporting to excel (using proc report and ods excel)</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/columns-width-is-changed-when-exporting-to-excel-using-proc/m-p/937992#M26691</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/446135"&gt;@Rabelais&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thanks, but absolute_column_width does set the same width to all columns, doesn't it?&lt;BR /&gt;&lt;BR /&gt;What if I need to set a different width to each column?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;see what happens to your output when you add absolute_column_width='0.5in,2.4in,3.1in'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can provide a list of values. The first is for column 1 or A, second for column 2 or B, etc. . Then the settings repeat if columns to the right are used for columns past the defined. Column D would be the same width as A, E as B, F as C.&lt;/P&gt;
&lt;P&gt;If you provide a single value then all columns are the same. Just a degenerate behavior of the repeating column definitions above.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2024 17:04:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/columns-width-is-changed-when-exporting-to-excel-using-proc/m-p/937992#M26691</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-08-01T17:04:07Z</dc:date>
    </item>
    <item>
      <title>Re: columns' width is changed when exporting to excel (using proc report and ods excel)</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/columns-width-is-changed-when-exporting-to-excel-using-proc/m-p/938000#M26692</link>
      <description>&lt;P&gt;What are you using for the value of&amp;nbsp;borderleftwidth? (and borderrightwidth)&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2024 18:25:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/columns-width-is-changed-when-exporting-to-excel-using-proc/m-p/938000#M26692</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-08-01T18:25:38Z</dc:date>
    </item>
    <item>
      <title>Re: columns' width is changed when exporting to excel (using proc report and ods excel)</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/columns-width-is-changed-when-exporting-to-excel-using-proc/m-p/938085#M26694</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt; It works! Didn't know we can pass a list of widths, many thanks!</description>
      <pubDate>Fri, 02 Aug 2024 15:25:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/columns-width-is-changed-when-exporting-to-excel-using-proc/m-p/938085#M26694</guid>
      <dc:creator>Rabelais</dc:creator>
      <dc:date>2024-08-02T15:25:55Z</dc:date>
    </item>
    <item>
      <title>Re: columns' width is changed when exporting to excel (using proc report and ods excel)</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/columns-width-is-changed-when-exporting-to-excel-using-proc/m-p/938086#M26695</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt; I did not set any value for borderleftwidth, so I guess SAS uses the default one</description>
      <pubDate>Fri, 02 Aug 2024 15:26:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/columns-width-is-changed-when-exporting-to-excel-using-proc/m-p/938086#M26695</guid>
      <dc:creator>Rabelais</dc:creator>
      <dc:date>2024-08-02T15:26:43Z</dc:date>
    </item>
  </channel>
</rss>

