<?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: Modify columns width in a proc report with across in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Modify-columns-width-in-a-proc-report-with-across/m-p/729400#M226966</link>
    <description>&lt;P&gt;Thank you very much!! I had not considered the possibility of providing the information as a format, real interesting solution. ps. there was no erorr in the log&lt;/P&gt;</description>
    <pubDate>Fri, 26 Mar 2021 14:51:33 GMT</pubDate>
    <dc:creator>g_lanzi</dc:creator>
    <dc:date>2021-03-26T14:51:33Z</dc:date>
    <item>
      <title>Modify columns width in a proc report with across</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Modify-columns-width-in-a-proc-report-with-across/m-p/729360#M226944</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i'm trying to set colomns width for each column of an across variable in a proc report.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my dataset structure:&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;STRATA1&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;STRATA2&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;_NAME_&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;COL1&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CAT1&lt;/TD&gt;&lt;TD&gt;CAT2&lt;/TD&gt;&lt;TD&gt;NObs1&lt;/TD&gt;&lt;TD&gt;xx&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CAT1&lt;/TD&gt;&lt;TD&gt;CAT2&lt;/TD&gt;&lt;TD&gt;mean&lt;/TD&gt;&lt;TD&gt;xxx&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CAT1&lt;/TD&gt;&lt;TD&gt;CAT2&lt;/TD&gt;&lt;TD&gt;std&lt;/TD&gt;&lt;TD&gt;xxx&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CAT1&lt;/TD&gt;&lt;TD&gt;CAT2&lt;/TD&gt;&lt;TD&gt;median&lt;/TD&gt;&lt;TD&gt;xxx&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CAT1&lt;/TD&gt;&lt;TD&gt;CAT2&lt;/TD&gt;&lt;TD&gt;Q13&lt;/TD&gt;&lt;TD&gt;xxx; xxx&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CAT1&lt;/TD&gt;&lt;TD&gt;CAT2&lt;/TD&gt;&lt;TD&gt;Minmax&lt;/TD&gt;&lt;TD&gt;xxx; xxx&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the format code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format ;
value $label 
	  "N" =  "N"
	  "NObs1" = "n"
	  "mean" = "Mean"
      "median" = "Median"
	  "std" = "Std Dev"
	  "Q13" = "Q1; Q3"
	  "Minmax" = "Min; Max"

;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the proc report code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;goptions device=png;
ods listing close;
options nodate nonumber orientation = landscape nobyline;
ods rtf file= "file.rtf"  style = customtemp;
title1 j=l "title";
proc report data=report missing nowd split="|" style(header)={just = center} ;
columns ("" STRATA1 STRATA2)  ( _NAME_,(COL1)) dummy ;

define STRATA2  /' ' group style(column)={cellwidth=0.08in just = left};
define STRATA1  /' ' group style(column)={cellwidth=0.08in just = left};
define _NAME_ /' ' nozero across order = data style(column)={just = center} format = $label.;
define COL1   /' ' style(column)={cellwidth=0.10in just = center};
define dummy  /computed noprint;

compute _NAME_;

	if compress(_NAME_) = 'NObs1' then call define(_col_, "style/merge", "style=[cellwidth=0.03in]");  
	else if compress(_NAME_) = 'mean' then call define(_col_, "style/merge", "style=[cellwidth=0.04in]"); 
	else if compress(_NAME_) = 'median' then call define(_col_, "style/merge", "style=[cellwidth=0.04in]"); 
	else if compress(_NAME_) = 'std' then call define(_col_, "style/merge", "style=[cellwidth=0.04in]"); 
	else if compress(_NAME_) = 'Q13' then call define(_col_, "style/merge", "style=[cellwidth=0.05in]"); 
	else if compress(_NAME_) = 'Minmax' then call define(_col_, "style/merge", "style=[cellwidth=0.05in]");  

endcomp;

run;
ods rtf close;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;It does not change the columns width.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I also tryed with the following code with the same result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;compute _NAME_;

	if compress(_NAME_) = 'NObs1' then call define('NObs1', "style/merge", "style=[cellwidth=0.03in]");  
	else if compress(_NAME_) = 'mean' then call define('mean', "style/merge", "style=[cellwidth=0.04in]"); 
	else if compress(_NAME_) = 'median' then call define('median', "style/merge", "style=[cellwidth=0.04in]"); 
	else if compress(_NAME_) = 'std' then call define('std', "style/merge", "style=[cellwidth=0.04in]"); 
	else if compress(_NAME_) = 'Q13' then call define('Q13', "style/merge", "style=[cellwidth=0.05in]"); 
	else if compress(_NAME_) = 'Minmax' then call define('Minmax', "style/merge", "style=[cellwidth=0.05in]");  

endcomp;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;could you help me?&lt;/P&gt;</description>
      <pubDate>Fri, 26 Mar 2021 12:20:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Modify-columns-width-in-a-proc-report-with-across/m-p/729360#M226944</guid>
      <dc:creator>g_lanzi</dc:creator>
      <dc:date>2021-03-26T12:20:16Z</dc:date>
    </item>
    <item>
      <title>Re: Modify columns width in a proc report with across</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Modify-columns-width-in-a-proc-report-with-across/m-p/729391#M226959</link>
      <description>&lt;P&gt;0.04in and similar&amp;nbsp; is likely the culprit. A cell that small very likely does not have room for more than one character.&lt;/P&gt;
&lt;P&gt;Are you getting any messages in the log?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is an example of using a format to set the width of the column based on the value of the Name.&lt;/P&gt;
&lt;PRE&gt;proc format;
value $cw
"N" =  ".5in"
"NObs1" = "1in"
"median" = "1.5in"
;
run;

data junk;
  input row name $ value;
datalines;
1 N  2300
2 Nobs1 110
3 median 17.4
;

proc report data=junk;
   columns row name, value;
   define row /group;
   define name /across style=[cellwidth=$cw.];
run;&lt;/PRE&gt;
&lt;P&gt;You can use the same approach to change font, text color, background color and most items that appear in a style block for a cell.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Mar 2021 14:22:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Modify-columns-width-in-a-proc-report-with-across/m-p/729391#M226959</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-03-26T14:22:36Z</dc:date>
    </item>
    <item>
      <title>Re: Modify columns width in a proc report with across</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Modify-columns-width-in-a-proc-report-with-across/m-p/729400#M226966</link>
      <description>&lt;P&gt;Thank you very much!! I had not considered the possibility of providing the information as a format, real interesting solution. ps. there was no erorr in the log&lt;/P&gt;</description>
      <pubDate>Fri, 26 Mar 2021 14:51:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Modify-columns-width-in-a-proc-report-with-across/m-p/729400#M226966</guid>
      <dc:creator>g_lanzi</dc:creator>
      <dc:date>2021-03-26T14:51:33Z</dc:date>
    </item>
  </channel>
</rss>

