<?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: Moved spanned columns on other rows in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Moved-spanned-columns-on-other-rows/m-p/456557#M20877</link>
    <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; What you want really can't be done with PROC REPORT. Once you have a header that spans ALL the columns, (like the middle header for Spanning 2 that is shown below) with PROC REPORT, the only thing that can go above it is another header that spans the entire row, like the header for Spanning 1 -- this header cannot be "split" into 2 columns with PROC REPORT:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="span2_report.png" style="width: 329px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/20044i223670397106779B/image-size/large?v=v2&amp;amp;px=999" role="button" title="span2_report.png" alt="span2_report.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, it can be done for HTML and PDF in the Report Writing Interface (RWI), as shown here:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="span_5_rwi.png" style="width: 370px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/20043i9B7E29369164D9F5/image-size/large?v=v2&amp;amp;px=999" role="button" title="span_5_rwi.png" alt="span_5_rwi.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code that produced the screen shot is here:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
ods html(id=sp) file="c:\temp\diff_span.html";
   
title '1) Detail Report';
data _null_; 
  set SASHELP.class end=last; 
  if _N_ = 1 then do; 
      dcl odsout obj(); 
      obj.table_start(); 
      obj.head_start(); 
      ** Header row 1;
      obj.row_start(type:"Header");
      obj.format_cell(text: "A", column_span:3, style_attr:"fontweight=bold"); 
      obj.format_cell(text: "B", column_span:2,style_attr:"fontweight=bold"); 
      obj.row_end(); 
      ** Header row 2;
      obj.row_start(type:"Header");
      obj.format_cell(text: "Spanning All 5 Columns", column_span:5,style_attr:"background=lightyellow"); 
      obj.row_end(); 
      ** Header row 3;
      obj.row_start(type: "Header"); 
      obj.format_cell(text: "Name", style_attr:"fontweight=bold"); 
      obj.format_cell(text: "Age", style_attr:"fontweight=bold"); 
      obj.format_cell(text: "Sex", style_attr:"fontweight=bold"); 
      obj.format_cell(text: "Height", style_attr:"fontweight=bold"); 
      obj.format_cell(text: "Weight", style_attr:"fontweight=bold"); 
      obj.row_end(); 
      obj.head_end(); 
    end;
  ** row for every obs;
      obj.row_start(); 
      obj.format_cell(data: name ); 
      obj.format_cell(data: age); 
      obj.format_cell(data: sex); 
      obj.format_cell(data: height); 
      obj.format_cell(data: weight); 
      obj.row_end(); 
   
  if last then do; 
      obj.table_end(); 
    end; 
run; 
ods html(id=sp) close;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp; Hope this helps,&lt;/P&gt;
&lt;P&gt;cynthia&lt;/P&gt;</description>
    <pubDate>Mon, 23 Apr 2018 15:23:17 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2018-04-23T15:23:17Z</dc:date>
    <item>
      <title>Moved spanned columns on other rows</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Moved-spanned-columns-on-other-rows/m-p/456381#M20875</link>
      <description>&lt;P&gt;I have a code here that adds spanned columns on proc report.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;proc report nowd data=sashelp.class(obs=5);
col (
     ('this is spanned'
     ('A' age sex) ('B' weight height) 
    ) 
);
run;&lt;/PRE&gt;&lt;P&gt;The output would be like this&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="output 1.PNG" style="width: 165px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/20030i87E9D234C4F8469A/image-size/large?v=v2&amp;amp;px=999" role="button" title="output 1.PNG" alt="output 1.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I output it in such a way that the spanned columns would be placed on the 2nd row like this one?&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="output span.PNG" style="width: 236px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/20031i08A9DAB10D27173C/image-dimensions/236x142?v=v2" width="236" height="142" role="button" title="output span.PNG" alt="output span.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Apr 2018 03:09:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Moved-spanned-columns-on-other-rows/m-p/456381#M20875</guid>
      <dc:creator>albertsamaniego</dc:creator>
      <dc:date>2018-04-23T03:09:44Z</dc:date>
    </item>
    <item>
      <title>Re: Moved spanned columns on other rows</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Moved-spanned-columns-on-other-rows/m-p/456557#M20877</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; What you want really can't be done with PROC REPORT. Once you have a header that spans ALL the columns, (like the middle header for Spanning 2 that is shown below) with PROC REPORT, the only thing that can go above it is another header that spans the entire row, like the header for Spanning 1 -- this header cannot be "split" into 2 columns with PROC REPORT:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="span2_report.png" style="width: 329px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/20044i223670397106779B/image-size/large?v=v2&amp;amp;px=999" role="button" title="span2_report.png" alt="span2_report.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, it can be done for HTML and PDF in the Report Writing Interface (RWI), as shown here:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="span_5_rwi.png" style="width: 370px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/20043i9B7E29369164D9F5/image-size/large?v=v2&amp;amp;px=999" role="button" title="span_5_rwi.png" alt="span_5_rwi.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code that produced the screen shot is here:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
ods html(id=sp) file="c:\temp\diff_span.html";
   
title '1) Detail Report';
data _null_; 
  set SASHELP.class end=last; 
  if _N_ = 1 then do; 
      dcl odsout obj(); 
      obj.table_start(); 
      obj.head_start(); 
      ** Header row 1;
      obj.row_start(type:"Header");
      obj.format_cell(text: "A", column_span:3, style_attr:"fontweight=bold"); 
      obj.format_cell(text: "B", column_span:2,style_attr:"fontweight=bold"); 
      obj.row_end(); 
      ** Header row 2;
      obj.row_start(type:"Header");
      obj.format_cell(text: "Spanning All 5 Columns", column_span:5,style_attr:"background=lightyellow"); 
      obj.row_end(); 
      ** Header row 3;
      obj.row_start(type: "Header"); 
      obj.format_cell(text: "Name", style_attr:"fontweight=bold"); 
      obj.format_cell(text: "Age", style_attr:"fontweight=bold"); 
      obj.format_cell(text: "Sex", style_attr:"fontweight=bold"); 
      obj.format_cell(text: "Height", style_attr:"fontweight=bold"); 
      obj.format_cell(text: "Weight", style_attr:"fontweight=bold"); 
      obj.row_end(); 
      obj.head_end(); 
    end;
  ** row for every obs;
      obj.row_start(); 
      obj.format_cell(data: name ); 
      obj.format_cell(data: age); 
      obj.format_cell(data: sex); 
      obj.format_cell(data: height); 
      obj.format_cell(data: weight); 
      obj.row_end(); 
   
  if last then do; 
      obj.table_end(); 
    end; 
run; 
ods html(id=sp) close;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp; Hope this helps,&lt;/P&gt;
&lt;P&gt;cynthia&lt;/P&gt;</description>
      <pubDate>Mon, 23 Apr 2018 15:23:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Moved-spanned-columns-on-other-rows/m-p/456557#M20877</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2018-04-23T15:23:17Z</dc:date>
    </item>
  </channel>
</rss>

