<?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: Proc report SPANROWS for multiple columns with different groupings in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-report-SPANROWS-for-multiple-columns-with-different/m-p/409198#M19744</link>
    <description>&lt;P&gt;Hi, well, it would be easiest to do in PROC REPORT if you just moved SUMMARY to the left of VALUE. Otherwise, when you have SUMMARY on the end of the report row, PROC REPORT will not span because each unique VALUE now gets its own SUMMARY cell. Compare these 2 outputs using your original data:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;title '1) summary before value';
title2 'since summary is the same for all values, you get spanning';
proc report data=test spanrows;
  column group summary value;
  define group / group;
  define summary / group;
  define value / order order=data;
run;

title '2) summary after value';
title2 'since each summary is now unique for each value, you get a cell for each value';
proc report data=test spanrows;
  column group value summary ;
  define group / group;
  define value / order order=data;
  define summary / group;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;PROC REPORT does build the report row from left to right and so, when you have the VALUE column with 2 unique values, that forces the SUMMARY column to be filled for each of the unique values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;cynthia&lt;/P&gt;</description>
    <pubDate>Tue, 31 Oct 2017 16:16:59 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2017-10-31T16:16:59Z</dc:date>
    <item>
      <title>Proc report SPANROWS for multiple columns with different groupings</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-report-SPANROWS-for-multiple-columns-with-different/m-p/408931#M19730</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to create a report that has multiple columns with merged rows. I'm using the SPANROWS option to merge repeating values, but PROC REPORT seems to be&amp;nbsp;splitting "higher" level (less granular) groups based on "lower" level (more granular) groups that appear earlier in the COLUMN statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The below code replicates my issue:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input group $ value summary;
cards;
apple 4 4.25
apple 2 4.25
banana 6 4.25
banana 5 4.25
;
run;

proc report data=test nowd spanrows;
    columns group value summary;
        define group / group;
        define value / display;
        define summary / group;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 175px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/16324iBDD87988CB200A4A/image-size/small?v=v2&amp;amp;px=200" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I would like to generate the report such that the rows for "summary" are spanned across all rows (so 4.25 appears only once and the 4 rows are merged), not just the first two and the last two. I can get it to work by moving the "summary" column&amp;nbsp;before "group", but of course, I want summary to appear at the right of the table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone know of any tips to&amp;nbsp;generate a report this way? Is it even possible?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am&amp;nbsp;running SAS 9.4 TS1M4.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Oct 2017 22:48:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-report-SPANROWS-for-multiple-columns-with-different/m-p/408931#M19730</guid>
      <dc:creator>bstarr</dc:creator>
      <dc:date>2017-10-30T22:48:14Z</dc:date>
    </item>
    <item>
      <title>Re: Proc report SPANROWS for multiple columns with different groupings</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-report-SPANROWS-for-multiple-columns-with-different/m-p/409112#M19733</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Well, you might not be able to do this with PROC REPORT. There are other alternatives, like the Report Writing Interface. But the structure and rules of the data will make a difference. For example, what about KIWI in this revised set of data? Is this ever possible? Or what about oranges? There are 3 rows -- in your data, you always show 2 rows. Is the data "pre-summarized"? Are there always 2 rows? could the same group have more than 1 summary?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;cynthia&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;apple 4 4.25&lt;BR /&gt;apple 2 4.25&lt;BR /&gt;banana 6 4.25&lt;BR /&gt;banana 5 4.25&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;kiwi 4 4.44&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;kiwi 2 2.22&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;kiwi 1 2.22&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT color="#FF6600"&gt;oranges 7 3.33&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT color="#FF6600"&gt;oranges 6 3.33&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT color="#FF6600"&gt;oranges 5 3.33&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2017 13:58:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-report-SPANROWS-for-multiple-columns-with-different/m-p/409112#M19733</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2017-10-31T13:58:11Z</dc:date>
    </item>
    <item>
      <title>Re: Proc report SPANROWS for multiple columns with different groupings</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-report-SPANROWS-for-multiple-columns-with-different/m-p/409156#M19737</link>
      <description>&lt;P&gt;Hi Cynthia,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your reply. In my particular data, I will always have 4 rows total, divided into 2 groups with&amp;nbsp;2 rows each. However, I could see use of this extending beyond my data to something more along the lines of your example (although there would likely only be 1 summary per group or over multiple groups).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes, my data are pre-summarized - I am essentially using PROC REPORT as a glorified PROC PRINT. I have tried using the summary capabilities in PROC REPORT and ran into other issues with getting the report layout how I want. In line "apple 4" of my example the 4 will actually be a mean in the report I am trying to build and in line "apple 2" the 2 will actually be a count (and the 4.25 will be a result from statistical significance testing), and I was having difficulties bringing the count a row down into the same column as the mean.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Another alternative that I will likely do is to generate the report close to what I want, then manually&amp;nbsp;merge cells and make other formatting changes in the final ODS RTF output.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Brian&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2017 15:06:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-report-SPANROWS-for-multiple-columns-with-different/m-p/409156#M19737</guid>
      <dc:creator>bstarr</dc:creator>
      <dc:date>2017-10-31T15:06:10Z</dc:date>
    </item>
    <item>
      <title>Re: Proc report SPANROWS for multiple columns with different groupings</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-report-SPANROWS-for-multiple-columns-with-different/m-p/409198#M19744</link>
      <description>&lt;P&gt;Hi, well, it would be easiest to do in PROC REPORT if you just moved SUMMARY to the left of VALUE. Otherwise, when you have SUMMARY on the end of the report row, PROC REPORT will not span because each unique VALUE now gets its own SUMMARY cell. Compare these 2 outputs using your original data:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;title '1) summary before value';
title2 'since summary is the same for all values, you get spanning';
proc report data=test spanrows;
  column group summary value;
  define group / group;
  define summary / group;
  define value / order order=data;
run;

title '2) summary after value';
title2 'since each summary is now unique for each value, you get a cell for each value';
proc report data=test spanrows;
  column group value summary ;
  define group / group;
  define value / order order=data;
  define summary / group;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;PROC REPORT does build the report row from left to right and so, when you have the VALUE column with 2 unique values, that forces the SUMMARY column to be filled for each of the unique values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;cynthia&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2017 16:16:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-report-SPANROWS-for-multiple-columns-with-different/m-p/409198#M19744</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2017-10-31T16:16:59Z</dc:date>
    </item>
  </channel>
</rss>

