<?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 Creating a Table with Row and Column Spanning in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-Table-with-Row-and-Column-Spanning/m-p/911359#M44166</link>
    <description>&lt;P&gt;I want to create table with&amp;nbsp;Row and Column Spanning. i use&amp;nbsp;Report Writing Interface and Proc report .&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=" language-sas"&gt;data have;
input A B $ C E F G I K L M N;
datalines;
1 japan 190 46 15 0 0 0 0 0 1
2 us 152 39 47 86 0 0 0 0 1
3 aus 50 6 36 41 0 0 0 0 1
;

data have1;
input A B $ C E F G I K L M N;
datalines;
1 ind 10 4 1 0 0 0 0 0 1
2 nep 12 3 7 8 0 0 0 0 1
3 newz 5 6 6 1 0 0 0 0 1
;



ods excel file="report.xlsx" options (sheet_interval="none") ;
data _null_;
    set have end=done;
     * first start the table and create the header;
     if _n_ eq 1 then do;
         declare odsout t(); * create a report writing interface object named t;

         t.table_start(); * start the table;
         t.head_start(); * start the header (so that these items get the default header style);
            * in this case the header is 3 rows in height. the ROWSPAN and COLSPAN items 
                control the size of each cell in the header;
             t.row_start();
                 t.format_cell(text: 'A', rowspan:3);
                 t.format_cell(text: 'B', rowspan:3);
                 t.format_cell(text: 'C', rowspan:3);
                 t.format_cell(text: 'D', rowspan:2, colspan:2);
                 t.format_cell(text: 'G', rowspan:3);
                 t.format_cell(text: 'H', colspan:5);
             t.row_end();

             t.row_start();
                 t.format_cell(text: 'I', rowspan:2);
                 t.format_cell(text: 'J', colspan:3);
                 t.format_cell(text: 'N', rowspan:2);
             t.row_end();

             t.row_start();
                 t.format_cell(text:'E');
                 t.format_cell(text:'F');
                 t.format_cell(text:'K');
                 t.format_cell(text:'L');
                 t.format_cell(text:'M');
             t.row_end();
         t.head_end();
     end;

     * the rest of the cells are all simply data values;
     t.row_start();
         t.format_cell(text: A);
         t.format_cell(text: B);
         t.format_cell(text: C);
         t.format_cell(text: E);
         t.format_cell(text: F);
         t.format_cell(text: G);
         t.format_cell(text: I);
         t.format_cell(text: K);
         t.format_cell(text: L);
         t.format_cell(text: M);
         t.format_cell(text: N);
     t.row_end();

     if done then t.table_end();
run;


proc report data=have1 ;
column ("A" ("" A)) ("B" ("" B)) ("C" ("" C)) ("D" (("E" E) ("F" F))) ("G" ("" G))
("H" ("I" I) ('J' K L M) ("N" N));
define A / "" display;
define B / "" display;
define C / "" display;
define E / "" display;
define F / "" display;
define G / "" display;
define I / "" display;
define K / display;
define L / display;
define M / display;
define N / "" display;
run;

ods _all_ close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;i have&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Daily1_0-1705049416099.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/92476iD71CFCE1DB7A15EF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Daily1_0-1705049416099.png" alt="Daily1_0-1705049416099.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;i want&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Daily1_1-1705049458966.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/92477iAF04CEAFC77E5FCC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Daily1_1-1705049458966.png" alt="Daily1_1-1705049458966.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 12 Jan 2024 09:02:32 GMT</pubDate>
    <dc:creator>Daily1</dc:creator>
    <dc:date>2024-01-12T09:02:32Z</dc:date>
    <item>
      <title>Creating a Table with Row and Column Spanning</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-Table-with-Row-and-Column-Spanning/m-p/911359#M44166</link>
      <description>&lt;P&gt;I want to create table with&amp;nbsp;Row and Column Spanning. i use&amp;nbsp;Report Writing Interface and Proc report .&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=" language-sas"&gt;data have;
input A B $ C E F G I K L M N;
datalines;
1 japan 190 46 15 0 0 0 0 0 1
2 us 152 39 47 86 0 0 0 0 1
3 aus 50 6 36 41 0 0 0 0 1
;

data have1;
input A B $ C E F G I K L M N;
datalines;
1 ind 10 4 1 0 0 0 0 0 1
2 nep 12 3 7 8 0 0 0 0 1
3 newz 5 6 6 1 0 0 0 0 1
;



ods excel file="report.xlsx" options (sheet_interval="none") ;
data _null_;
    set have end=done;
     * first start the table and create the header;
     if _n_ eq 1 then do;
         declare odsout t(); * create a report writing interface object named t;

         t.table_start(); * start the table;
         t.head_start(); * start the header (so that these items get the default header style);
            * in this case the header is 3 rows in height. the ROWSPAN and COLSPAN items 
                control the size of each cell in the header;
             t.row_start();
                 t.format_cell(text: 'A', rowspan:3);
                 t.format_cell(text: 'B', rowspan:3);
                 t.format_cell(text: 'C', rowspan:3);
                 t.format_cell(text: 'D', rowspan:2, colspan:2);
                 t.format_cell(text: 'G', rowspan:3);
                 t.format_cell(text: 'H', colspan:5);
             t.row_end();

             t.row_start();
                 t.format_cell(text: 'I', rowspan:2);
                 t.format_cell(text: 'J', colspan:3);
                 t.format_cell(text: 'N', rowspan:2);
             t.row_end();

             t.row_start();
                 t.format_cell(text:'E');
                 t.format_cell(text:'F');
                 t.format_cell(text:'K');
                 t.format_cell(text:'L');
                 t.format_cell(text:'M');
             t.row_end();
         t.head_end();
     end;

     * the rest of the cells are all simply data values;
     t.row_start();
         t.format_cell(text: A);
         t.format_cell(text: B);
         t.format_cell(text: C);
         t.format_cell(text: E);
         t.format_cell(text: F);
         t.format_cell(text: G);
         t.format_cell(text: I);
         t.format_cell(text: K);
         t.format_cell(text: L);
         t.format_cell(text: M);
         t.format_cell(text: N);
     t.row_end();

     if done then t.table_end();
run;


proc report data=have1 ;
column ("A" ("" A)) ("B" ("" B)) ("C" ("" C)) ("D" (("E" E) ("F" F))) ("G" ("" G))
("H" ("I" I) ('J' K L M) ("N" N));
define A / "" display;
define B / "" display;
define C / "" display;
define E / "" display;
define F / "" display;
define G / "" display;
define I / "" display;
define K / display;
define L / display;
define M / display;
define N / "" display;
run;

ods _all_ close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;i have&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Daily1_0-1705049416099.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/92476iD71CFCE1DB7A15EF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Daily1_0-1705049416099.png" alt="Daily1_0-1705049416099.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;i want&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Daily1_1-1705049458966.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/92477iAF04CEAFC77E5FCC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Daily1_1-1705049458966.png" alt="Daily1_1-1705049458966.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2024 09:02:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-Table-with-Row-and-Column-Spanning/m-p/911359#M44166</guid>
      <dc:creator>Daily1</dc:creator>
      <dc:date>2024-01-12T09:02:32Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a Table with Row and Column Spanning</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-Table-with-Row-and-Column-Spanning/m-p/911382#M44167</link>
      <description>&lt;P&gt;The DATA _NULL_ technique produced the&amp;nbsp;&lt;STRONG&gt;have&lt;/STRONG&gt; report in your desired format.&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Why did you use PROC REPORT instead of a second DATA _NULL_ step?&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;Do you want the second table to appear in its own tab? It kind of looks that way from how you posed the question.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;You can use the ODS EXCEL statement sheet_interval="&lt;STRONG&gt;table&lt;/STRONG&gt;" option to make the tables appear on individual tabs.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
   input A B $ C E F G I K L M N;
datalines;
1 japan 190 46 15 0 0 0 0 0 1
2 us 152 39 47 86 0 0 0 0 1
3 aus 50 6 36 41 0 0 0 0 1
;

data have1;
   input A B $ C E F G I K L M N;
datalines;
1 ind 10 4 1 0 0 0 0 0 1
2 nep 12 3 7 8 0 0 0 0 1
3 newz 5 6 6 1 0 0 0 0 1
;

ods excel file="report.xlsx" options (sheet_interval="&lt;STRONG&gt;table&lt;/STRONG&gt;") ;
data _null_;
    set have end=done;
     * first start the table and create the header;
     if _n_ eq 1 then do;
         declare odsout t(); * create a report writing interface object named t;

         t.table_start(); * start the table;
         t.head_start(); * start the header (so that these items get the default header style);
            * in this case the header is 3 rows in height. the ROWSPAN and COLSPAN items 
                control the size of each cell in the header;
             t.row_start();
                 t.format_cell(text: 'A', rowspan:3);
                 t.format_cell(text: 'B', rowspan:3);
                 t.format_cell(text: 'C', rowspan:3);
                 t.format_cell(text: 'D', rowspan:2, colspan:2);
                 t.format_cell(text: 'G', rowspan:3);
                 t.format_cell(text: 'H', colspan:5);
             t.row_end();

             t.row_start();
                 t.format_cell(text: 'I', rowspan:2);
                 t.format_cell(text: 'J', colspan:3);
                 t.format_cell(text: 'N', rowspan:2);
             t.row_end();

             t.row_start();
                 t.format_cell(text:'E');
                 t.format_cell(text:'F');
                 t.format_cell(text:'K');
                 t.format_cell(text:'L');
                 t.format_cell(text:'M');
             t.row_end();
         t.head_end();
     end;

     * the rest of the cells are all simply data values;
     t.row_start();
         t.format_cell(text: A);
         t.format_cell(text: B);
         t.format_cell(text: C);
         t.format_cell(text: E);
         t.format_cell(text: F);
         t.format_cell(text: G);
         t.format_cell(text: I);
         t.format_cell(text: K);
         t.format_cell(text: L);
         t.format_cell(text: M);
         t.format_cell(text: N);
     t.row_end();

     if done then t.table_end();
run;

data _null_;
    set &lt;STRONG&gt;have1&lt;/STRONG&gt; end=done;
     * first start the table and create the header;
     if _n_ eq 1 then do;
         declare odsout t(); * create a report writing interface object named t;

         t.table_start(); * start the table;
         t.head_start(); * start the header (so that these items get the default header style);
            * in this case the header is 3 rows in height. the ROWSPAN and COLSPAN items 
                control the size of each cell in the header;
             t.row_start();
                 t.format_cell(text: 'A', rowspan:3);
                 t.format_cell(text: 'B', rowspan:3);
                 t.format_cell(text: 'C', rowspan:3);
                 t.format_cell(text: 'D', rowspan:2, colspan:2);
                 t.format_cell(text: 'G', rowspan:3);
                 t.format_cell(text: 'H', colspan:5);
             t.row_end();

             t.row_start();
                 t.format_cell(text: 'I', rowspan:2);
                 t.format_cell(text: 'J', colspan:3);
                 t.format_cell(text: 'N', rowspan:2);
             t.row_end();

             t.row_start();
                 t.format_cell(text:'E');
                 t.format_cell(text:'F');
                 t.format_cell(text:'K');
                 t.format_cell(text:'L');
                 t.format_cell(text:'M');
             t.row_end();
         t.head_end();
     end;

     * the rest of the cells are all simply data values;
     t.row_start();
         t.format_cell(text: A);
         t.format_cell(text: B);
         t.format_cell(text: C);
         t.format_cell(text: E);
         t.format_cell(text: F);
         t.format_cell(text: G);
         t.format_cell(text: I);
         t.format_cell(text: K);
         t.format_cell(text: L);
         t.format_cell(text: M);
         t.format_cell(text: N);
     t.row_end();

     if done then t.table_end();
run;
ods excel close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Results:&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="SASJedi_2-1705065704757.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/92480iCEC6CC4CB46C5623/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SASJedi_2-1705065704757.png" alt="SASJedi_2-1705065704757.png" /&gt;&lt;/span&gt;&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="SASJedi_1-1705065670456.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/92479i28955CD0F9C80FB0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SASJedi_1-1705065670456.png" alt="SASJedi_1-1705065670456.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2024 13:23:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-Table-with-Row-and-Column-Spanning/m-p/911382#M44167</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2024-01-12T13:23:24Z</dc:date>
    </item>
  </channel>
</rss>

