<?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: Sum total row in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Sum-total-row/m-p/712956#M80046</link>
    <description>&lt;P&gt;Yes thought of it. Just seemed straight forward enough to use the computed memory value by the engine soon as a variable&amp;nbsp;was defined analysis. Point taken. Thank you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 21 Jan 2021 01:46:46 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2021-01-21T01:46:46Z</dc:date>
    <item>
      <title>Sum total row</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Sum-total-row/m-p/712934#M80042</link>
      <description>&lt;P&gt;I would like to add a total row to my table. Here is what I have:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Gender&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Freq&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Percent&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Males&lt;/TD&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;TD&gt;25%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Females&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;60&lt;/TD&gt;&lt;TD&gt;75%&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is what I'd like:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Gender&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Freq&lt;/TD&gt;&lt;TD&gt;Percent&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Males&lt;/TD&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;TD&gt;25%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Females&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;60&lt;/TD&gt;&lt;TD&gt;75%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Total&lt;/TD&gt;&lt;TD&gt;80&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just want the total there as its own row. What's the best proc to do this, as I realize you can do this a number of ways (tabulate, sql, etc.)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2021 23:55:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Sum-total-row/m-p/712934#M80042</guid>
      <dc:creator>Krysia24</dc:creator>
      <dc:date>2021-01-20T23:55:17Z</dc:date>
    </item>
    <item>
      <title>Re: Sum total row</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Sum-total-row/m-p/712935#M80043</link>
      <description>FREQ with WEIGHT or FREQ statements as you'll also get the percentages automatically. &lt;BR /&gt;PROC PRINT will also do that...&lt;BR /&gt;&lt;BR /&gt;The best proc depends on what you're doing next and why you're doing this in the first place.</description>
      <pubDate>Thu, 21 Jan 2021 00:02:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Sum-total-row/m-p/712935#M80043</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-01-21T00:02:45Z</dc:date>
    </item>
    <item>
      <title>Re: Sum total row</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Sum-total-row/m-p/712936#M80044</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
input Gender $ 	Freq 	Percent :percent.;
format percent percent.;
cards;
Males	20	25%
Females 	60	75%
;

proc sql;
 select * from have
 union all
 select 'Total', sum(freq),. from have;
quit;
/*or*/
proc report data=have;
 column gender freq percent;
 define freq/analysis;
 compute after;
  line 'Total' +2 freq.sum ;
 endcomp;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 Jan 2021 00:04:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Sum-total-row/m-p/712936#M80044</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2021-01-21T00:04:00Z</dc:date>
    </item>
    <item>
      <title>Re: Sum total row</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Sum-total-row/m-p/712955#M80045</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Or, in the interest of completeness -- without a LINE statement and using an RBREAK statement, you can generate the report either with or without a total for percent:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cynthia_sas_0-1611193388298.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/53727iF615EEF63C7C8670/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Cynthia_sas_0-1611193388298.png" alt="Cynthia_sas_0-1611193388298.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2021 01:43:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Sum-total-row/m-p/712955#M80045</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2021-01-21T01:43:28Z</dc:date>
    </item>
    <item>
      <title>Re: Sum total row</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Sum-total-row/m-p/712956#M80046</link>
      <description>&lt;P&gt;Yes thought of it. Just seemed straight forward enough to use the computed memory value by the engine soon as a variable&amp;nbsp;was defined analysis. Point taken. Thank you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2021 01:46:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Sum-total-row/m-p/712956#M80046</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2021-01-21T01:46:46Z</dc:date>
    </item>
    <item>
      <title>Re: Sum total row</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Sum-total-row/m-p/713033#M80047</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
 set sashelp.class;
run;

proc sql;
select sex,count(*) as n,calculated n/(select count(*) from have) as percent format=percent8.2 
 from have
  group by sex
union all
select 'Total' ,(select count(*) from have),. from have(obs=1);
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 Jan 2021 11:32:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Sum-total-row/m-p/713033#M80047</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-01-21T11:32:57Z</dc:date>
    </item>
    <item>
      <title>Re: Sum total row</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Sum-total-row/m-p/713092#M80048</link>
      <description>Yes, it is straightforward, but the LINE statement may not align with the cells above as shown in the original pix of the desired output. The LINE statement output spans the whole table, and by default, the output from LINE is usually centered, so Total, would not always line up under Gender. So that's the side effect of RBREAK because RBREAK maintains the same number of cells on the break line.&lt;BR /&gt;Cynthia</description>
      <pubDate>Thu, 21 Jan 2021 15:30:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Sum-total-row/m-p/713092#M80048</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2021-01-21T15:30:12Z</dc:date>
    </item>
    <item>
      <title>Re: Sum total row</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Sum-total-row/m-p/713094#M80049</link>
      <description>&lt;P&gt;Yes that makes sense. I agree! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also ,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13549"&gt;@Cynthia_sas&lt;/a&gt;&amp;nbsp; If you happen to know Jane Eslinger, please pass on my regards and gratitude to her for having authored that lovely proc report book. Kudos!!! I would say, a must read.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2021 17:46:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Sum-total-row/m-p/713094#M80049</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2021-01-21T17:46:22Z</dc:date>
    </item>
    <item>
      <title>Re: Sum total row</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Sum-total-row/m-p/713210#M80050</link>
      <description>You're right - -it is a great book. I'll pass on your praise to her.&lt;BR /&gt;Cynthia</description>
      <pubDate>Thu, 21 Jan 2021 20:20:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Sum-total-row/m-p/713210#M80050</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2021-01-21T20:20:40Z</dc:date>
    </item>
  </channel>
</rss>

