<?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 Custom Grand Total in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-Report-Custom-Grand-Total/m-p/285993#M16416</link>
    <description>oh well. thank you for your suggestions!</description>
    <pubDate>Wed, 20 Jul 2016 22:37:09 GMT</pubDate>
    <dc:creator>sasiscool</dc:creator>
    <dc:date>2016-07-20T22:37:09Z</dc:date>
    <item>
      <title>Proc Report Custom Grand Total</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-Report-Custom-Grand-Total/m-p/285644#M16394</link>
      <description>&lt;P&gt;I have a proc report output that&amp;nbsp;looks likes this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Year1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Year2&lt;/P&gt;&lt;P&gt;Group1 &amp;nbsp; Apple &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Berry &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/P&gt;&lt;P&gt;subtotal &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;4 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 6&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Group2 &amp;nbsp; Apple &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;7 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 9&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Berry &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3&lt;/P&gt;&lt;P&gt;subtotal &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 9 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;12&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;group3 &amp;nbsp; &amp;nbsp;apple &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;berry &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 5 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;&lt;P&gt;subtotal &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 6 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;grandtotal &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;X &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;X&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code looks like this&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;proc report data=x t1 out=test


define report_grp / group;
define fruit/ group format=$ftpt. ' ';
define term_desc / across ' ';

break after report_grp /summarize ;

rbreak after / summarize;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now, i am trying to force the grand total rbreak to repeat the subtotal of group1 ( which is 4&amp;nbsp;for Year 1 and 6 for Year 2).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I could manually enter it like:&lt;/P&gt;&lt;P&gt;compute after;&lt;BR /&gt;if report_grp=. then&lt;BR /&gt;_C3_=4;&lt;/P&gt;&lt;P&gt;_C4_=6;&lt;BR /&gt;endcomp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;or something similar with the _BREAK_ variable. However, I have to do this for several reports, and do not want to manually change a bunch of columns.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I have tried to think of a nifty way to just repeat that first subtotal line for the grand total, but I keep coming up short. I feel it is possible, but need some direction.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2016 21:40:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-Report-Custom-Grand-Total/m-p/285644#M16394</guid>
      <dc:creator>sasiscool</dc:creator>
      <dc:date>2016-07-19T21:40:00Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Report Custom Grand Total</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-Report-Custom-Grand-Total/m-p/285795#M16399</link>
      <description>Hi:&lt;BR /&gt;  I guess I don't understand why you would want to repeat the first group on the rbreak, that doesn't make sense unless somehow you have presummarized your data and Group1 isn't really Group1, but is the grand total (still doesn't make sense given the numbers you show). Of course, if you want the grand total both before and after the report, that's possible. The correct grand total for the output you show is 19 for year 1 and 21 for year 2. The only way to do the adjustment you want is to do what you're doing -- but I would not test for report_grp = ., it would be better to test for &lt;BR /&gt;if _break_ = '_RBREAK_' then .... (because the ONLY time when the automatic _BREAK_ value will be _RBREAK_ is on the last summary row of the report. And, besides, report_grp looks like a character variable, so it will never be a numeric missing (or .).&lt;BR /&gt;&lt;BR /&gt;cynthia</description>
      <pubDate>Wed, 20 Jul 2016 12:41:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-Report-Custom-Grand-Total/m-p/285795#M16399</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2016-07-20T12:41:15Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Report Custom Grand Total</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-Report-Custom-Grand-Total/m-p/285814#M16402</link>
      <description>&lt;P&gt;thank you so much Cynthia!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry in the haste of annonymizing my data, I should have been more careful. This table is more accurate&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Year1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Year2&lt;/P&gt;&lt;P&gt;Group1 &amp;nbsp; Apple &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;9&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;11&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Berry &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;7&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;4&lt;/P&gt;&lt;P&gt;subtotal &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;16&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;15&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Group2 &amp;nbsp; Apple &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;7 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 9&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Berry &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3&lt;/P&gt;&lt;P&gt;subtotal &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 9 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;12&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;group3 &amp;nbsp; &amp;nbsp;apple &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;berry &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 5 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;&lt;P&gt;subtotal &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 6 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;grandtotal &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;X &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;X&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There are three distinct groups. Group1 is, in fact, a total of group 2 and group 3. But, it is its own group and not a calculated variable or anything. Group 2 and Group3 are their own distinc groups, but if you add them, they equal group 1. Unfortunately, for the purposes of the report I am making, I need to have it look just like that--First column being group, sencond fruit, etc. &amp;nbsp;So, I can't just include an rbreak and only show group 2 and 3, since it won't break out each row for the fruit. ( I hope i am not being confusing!)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All I need is to get this subtotal:&lt;/P&gt;&lt;P&gt;"&amp;nbsp;&lt;SPAN&gt;subtotal &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;16&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;15" &amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;to also appear again at the bottom as a grandtotal. &amp;nbsp;I just can't think of a way to get to 'call' that row &amp;nbsp;since proc report doesn't work that way. &amp;nbsp;Maybe something with dummy variable ?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2016 13:52:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-Report-Custom-Grand-Total/m-p/285814#M16402</guid>
      <dc:creator>sasiscool</dc:creator>
      <dc:date>2016-07-20T13:52:49Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Report Custom Grand Total</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-Report-Custom-Grand-Total/m-p/285922#M16411</link>
      <description>&lt;P&gt;Hi:&lt;BR /&gt;&amp;nbsp; Unfortunately, once a row has been written to the report, PROC REPORT is done with it. So once PROC REPORT has written the row for GROUP1's summary line, then that row is done. PROC REPORT cannot call it back again at the bottom of the report. You could save the values in temporary variables or in macro variables, but there's nothing automatic that PROC REPORT can do to get you that value. This is the downfall of trying to pre-summarize your data. Depending on your destination of interest, It might be easier to just make 2 tables and then you don't need dummy variables, macro variables or anything else:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/4142i4F556AC87FC7734D/image-size/original?v=v2&amp;amp;px=-1" alt="use_2_proc_report.png" title="use_2_proc_report.png" border="0" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;cynthia&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2016 17:58:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-Report-Custom-Grand-Total/m-p/285922#M16411</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2016-07-20T17:58:39Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Report Custom Grand Total</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-Report-Custom-Grand-Total/m-p/285993#M16416</link>
      <description>oh well. thank you for your suggestions!</description>
      <pubDate>Wed, 20 Jul 2016 22:37:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-Report-Custom-Grand-Total/m-p/285993#M16416</guid>
      <dc:creator>sasiscool</dc:creator>
      <dc:date>2016-07-20T22:37:09Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Report Custom Grand Total</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-Report-Custom-Grand-Total/m-p/286000#M16417</link>
      <description>&lt;P&gt;Realizing that your actual report may be more complex a limited example of this is possible with a multilabel format and Proc tabulate.&lt;/P&gt;
&lt;P&gt;I suspect that this does not match your existing data layout as it sounds like you have done some summary to create your "group 1" ahead of time and appended data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The following approach &lt;STRONG&gt;might&lt;/STRONG&gt; be able to avoid that presumed summary step.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format library=work;
value grp (multilabel notsorted)
1,2 = "Group 1"
1   = "Group 2"
2   = "Group 3"
;
run;

data example;
   do year= 2012,2013;
      do i = 1 to (ceil(20*Ranuni(123)));
         group = rand('table',1/3,2/3);
         output;
      end;
   end;
run;

proc tabulate data=example;
   class group / mlf preloadfmt order=data;
   format group grp.;
   class year;
   table group='' all , year=''*n='';
run;
   &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Caveats: Only a few procedures support multilabel formats and I'm not sure Report does. Also Tabulate is somewhat more limited on calculations than Report as you can't calculate with the summaries and "breaks" aren't really available though All does summaries.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another way would be to repeat the ALL for the group variable with different labels&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
proc format library=work;
value grpx (multilabel notsorted)
1   = "Group 2"
2   = "Group 3"
;
run;
proc tabulate data=example;
   class group ;
   format group grpx.;
   class year;
   table all='Group 1' group='' all='Total' , year=''*n='';
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2016 23:41:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-Report-Custom-Grand-Total/m-p/286000#M16417</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-07-20T23:41:58Z</dc:date>
    </item>
  </channel>
</rss>

