<?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: Add total row PROC REPORT in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Add-total-row-PROC-REPORT/m-p/868390#M26251</link>
    <description>&lt;P&gt;Show actual data.&lt;/P&gt;
&lt;P&gt;Or show report result.&lt;/P&gt;
&lt;P&gt;Showing some bizarre mixture of the two does not clarify the situation at all.&lt;/P&gt;
&lt;P&gt;Here is an example you should be able to run because the SASHELP.Class data set is typically included in all installs.&lt;/P&gt;
&lt;PRE&gt;proc report data=sashelp.class;
  columns sex age,height total;
  define sex/ group;
  define age/across;
  define total/computed;
  compute total;
     total=sum(_c2_,_c3_,_c4_,_c5_,_c6_,_c7_);
  endcomp;
run;&lt;/PRE&gt;
&lt;P&gt;The row total uses columns 2 through 7 because there are 6 values of age in the Across position.&lt;/P&gt;</description>
    <pubDate>Thu, 06 Apr 2023 01:30:31 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2023-04-06T01:30:31Z</dc:date>
    <item>
      <title>Add total row PROC REPORT</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Add-total-row-PROC-REPORT/m-p/868374#M26248</link>
      <description>&lt;P&gt;Hello, trying to get row totals. I managed to get a total column on the very right, though the numbers across rows are not being summed. Please advise.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc report data=tb_cluster3 nowd
style(header)=[fontsize=6]
style(column)=[fontsize=4]
style(lines)=[fontsize=2];

columns case_status disease_name, started_therapy total;

define started_therapy / "Started Therapy" missing across;
define disease_name / "Disease Name" across;
define case_status / "Case Status" missing group;
define total / "Total" computed;

rbreak after / summarize style(summary)={font_weight=bold};

compute total;
 total=sum(case_status);
endcomp;

compute after;
  call define("case_status", "style", "style=[pretext='Totals']");
endcomp;

run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="table.PNG" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/82370i34EC9949C74B0059/image-size/large?v=v2&amp;amp;px=999" role="button" title="table.PNG" alt="table.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Apr 2023 22:25:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Add-total-row-PROC-REPORT/m-p/868374#M26248</guid>
      <dc:creator>vegan_renegade</dc:creator>
      <dc:date>2023-04-05T22:25:28Z</dc:date>
    </item>
    <item>
      <title>Re: Add total row PROC REPORT</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Add-total-row-PROC-REPORT/m-p/868385#M26249</link>
      <description>&lt;P&gt;Since the values that you want to total are the results of other actions you need to reference the columns that have the values you want.&lt;/P&gt;
&lt;P&gt;Instead of&lt;/P&gt;
&lt;PRE&gt;compute total;
 total=sum(case_status);
endcomp;&lt;/PRE&gt;
&lt;P&gt;You might want:&lt;/P&gt;
&lt;PRE&gt;compute total;
 total=sum(_c2_, _c3_ ,_c4_, _c5_,_c6_,_c7_,_c8_,_c9_,_c10_);
endcomp;&lt;/PRE&gt;
&lt;P&gt;Where C2 is the second column, the one to to the right of the CaseStatus. You could select specific columns as you desire 9 columns are shown because of the values of combination of values shown for your disease_name and started_therapy variables. Changes to values mean you need to recount the columns so this is not an automagical result.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Apr 2023 01:27:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Add-total-row-PROC-REPORT/m-p/868385#M26249</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-04-06T01:27:54Z</dc:date>
    </item>
    <item>
      <title>Re: Add total row PROC REPORT</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Add-total-row-PROC-REPORT/m-p/868387#M26250</link>
      <description>Thank you -  I'm not sure how to go about this since disease_name and started_therapy are variables (columns) within my dataset, but the responses to started_therapy (blank, Yes, No, Pending) are not columns, rather responses in the dataset. So I only have two columns to list, not nine.</description>
      <pubDate>Thu, 06 Apr 2023 00:27:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Add-total-row-PROC-REPORT/m-p/868387#M26250</guid>
      <dc:creator>vegan_renegade</dc:creator>
      <dc:date>2023-04-06T00:27:43Z</dc:date>
    </item>
    <item>
      <title>Re: Add total row PROC REPORT</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Add-total-row-PROC-REPORT/m-p/868390#M26251</link>
      <description>&lt;P&gt;Show actual data.&lt;/P&gt;
&lt;P&gt;Or show report result.&lt;/P&gt;
&lt;P&gt;Showing some bizarre mixture of the two does not clarify the situation at all.&lt;/P&gt;
&lt;P&gt;Here is an example you should be able to run because the SASHELP.Class data set is typically included in all installs.&lt;/P&gt;
&lt;PRE&gt;proc report data=sashelp.class;
  columns sex age,height total;
  define sex/ group;
  define age/across;
  define total/computed;
  compute total;
     total=sum(_c2_,_c3_,_c4_,_c5_,_c6_,_c7_);
  endcomp;
run;&lt;/PRE&gt;
&lt;P&gt;The row total uses columns 2 through 7 because there are 6 values of age in the Across position.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Apr 2023 01:30:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Add-total-row-PROC-REPORT/m-p/868390#M26251</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-04-06T01:30:31Z</dc:date>
    </item>
  </channel>
</rss>

