<?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: Any way to dynamically autofit width of cells so that data isn't chopped off? in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Any-way-to-dynamically-autofit-width-of-cells-so-that-data-isn-t/m-p/594546#M23364</link>
    <description>&lt;P&gt;You can control individual column widths with the ODS EXCEL option ABSOLUTE_COLUMN_WIDTH&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Generally specifying an appropriate format helps, You can also provide a WIDTH style element in the Define statements.&lt;/P&gt;
&lt;P&gt;You have hidden your proc report definitions in a macro so we can't see what else may be affecting the column widths. It may help to share the actual text generated by all this. You can easily provide that by running the proc report code with the Option mprint turned on prior to execution. Copy from the log the Code generated and paste into a code box on the forum opened using the {I} or "running man" icon.&lt;/P&gt;</description>
    <pubDate>Mon, 07 Oct 2019 20:31:01 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2019-10-07T20:31:01Z</dc:date>
    <item>
      <title>Any way to dynamically autofit width of cells so that data isn't chopped off?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Any-way-to-dynamically-autofit-width-of-cells-so-that-data-isn-t/m-p/594520#M23363</link>
      <description>&lt;P&gt;I'm working on a reporting macro which takes a SAS data set as input and spits it out to excel so that it looks pretty and is formatted nicely. I've got everything where I want it except that the columns aren't wide enough for several fields (long names, addresses, etc). I know that this can easily be remedited with width= but since I'm doing it as a macro for any data set is there any way to auto fit the width of each column based on the length of the data in the input data set?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Relevant SAS Code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* create "column" statement on the fly */
proc sql noprint;
   select strip(name)
   into :column_names separated by " "
   from dictionary.columns
   where upcase(memname) = upcase("&amp;amp;data_set");
quit;

/* create "define" statements on the fly */
proc sql noprint;
   select cat("define ", name, " / display ", '"', strip(coalesce(label, name)), '" CENTER', "; ")
   into :definition_lines separated by " "
   from dictionary.columns
   where upcase(memname) = upcase("&amp;amp;data_set.");
quit;  

ods excel file = &amp;amp;out.
  options (row_heights = "55, 12, 0, 16, 0, 0, 0"
   sheet_interval = "PROC"
   orientation = "landscape"
   center_horizontal = "yes"
   scale = "80"
   embedded_titles = "yes"
   frozen_headers = "5"
   gridlines = "off"
   row_repeat = "1-4"
   sheet_name = &amp;amp;sheet.);

proc report data = &amp;amp;data_set. nowd missing center headline headskip
   style(header) = {font_weight = BOLD 
                             background=#418fde
                             foreground=white}
   style(column)={vjust=center
                           tagattr="wrap:no"
                           asis=on};

column &amp;amp;column_names.;

&amp;amp;definition_lines.

run;

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Any help is appreciated, thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Oct 2019 18:13:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Any-way-to-dynamically-autofit-width-of-cells-so-that-data-isn-t/m-p/594520#M23363</guid>
      <dc:creator>tylerjazz1729</dc:creator>
      <dc:date>2019-10-07T18:13:57Z</dc:date>
    </item>
    <item>
      <title>Re: Any way to dynamically autofit width of cells so that data isn't chopped off?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Any-way-to-dynamically-autofit-width-of-cells-so-that-data-isn-t/m-p/594546#M23364</link>
      <description>&lt;P&gt;You can control individual column widths with the ODS EXCEL option ABSOLUTE_COLUMN_WIDTH&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Generally specifying an appropriate format helps, You can also provide a WIDTH style element in the Define statements.&lt;/P&gt;
&lt;P&gt;You have hidden your proc report definitions in a macro so we can't see what else may be affecting the column widths. It may help to share the actual text generated by all this. You can easily provide that by running the proc report code with the Option mprint turned on prior to execution. Copy from the log the Code generated and paste into a code box on the forum opened using the {I} or "running man" icon.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Oct 2019 20:31:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Any-way-to-dynamically-autofit-width-of-cells-so-that-data-isn-t/m-p/594546#M23364</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-10-07T20:31:01Z</dc:date>
    </item>
    <item>
      <title>Re: Any way to dynamically autofit width of cells so that data isn't chopped off?</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Any-way-to-dynamically-autofit-width-of-cells-so-that-data-isn-t/m-p/594718#M23365</link>
      <description>&lt;P&gt;You could use 'Column Length' in dictionary.columns to make a style CELLWIDTH=xxxx .&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2019 12:30:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Any-way-to-dynamically-autofit-width-of-cells-so-that-data-isn-t/m-p/594718#M23365</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-10-08T12:30:36Z</dc:date>
    </item>
  </channel>
</rss>

