<?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 tabulate question: adding cumulative row total in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-tabulate-question-adding-cumulative-row-total/m-p/982882#M379405</link>
    <description>&lt;P&gt;To get the desired percentages, you would have to restructure the table so that the sum and percent are stacked in the row dimension, rather than as columns in the column dimension. Here is an example.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc tabulate data=testtable order=data;
class  a b c d e f g /preloadfmt;
classlev  a b c d e f /s=[JUST=R];
var pyears;
*table a b c d e f ALL="TOTAL" ,
        ALL="Total" *(pyears=" "*(sum="py"*f=8.0 colpctsum="%"*f=8.1))
 g="exposure"*(pyears=" "*(sum="py"*f=8.0 colpctsum="%"*f=8.1)) ;
keylabel sum=' ';
table (a b)*pyears=' '*(sum="py"*f=8.0 colpctsum="%"*f=8.1)
 All='Total'*pyears=' '*(sum="py"*f=8.0 rowpctsum="%"*f=8.1),
 All='Total' g='exposure' / row=float;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 02 Feb 2026 20:09:49 GMT</pubDate>
    <dc:creator>Kathryn_SAS</dc:creator>
    <dc:date>2026-02-02T20:09:49Z</dc:date>
    <item>
      <title>Proc tabulate question: adding cumulative row total</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-tabulate-question-adding-cumulative-row-total/m-p/982873#M379404</link>
      <description>&lt;P&gt;All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have made a table that displays multiple levels for several variables. For each variable, there is a % column that displays the relative percentage for each level. This is all good, however, I am wondering if there is a way to make only my Total row to reflect rowpctsum and not colpctsum.&lt;BR /&gt;&lt;BR /&gt;Have:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sasgorilla_0-1770058377926.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/112949i642A041872A0ECE2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="sasgorilla_0-1770058377926.png" alt="sasgorilla_0-1770058377926.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Want:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sasgorilla_1-1770058426247.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/112950i019FB6254CAC45BE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="sasgorilla_1-1770058426247.png" alt="sasgorilla_1-1770058426247.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Code I am using is below:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc tabulate data=testtable noseps order=data;
	options nodate nonumber;
	Title Justify=Left
     "Test table";
	class  a b c d e f g /preloadfmt;
	classlev  a b c d e f /s=[JUST=R];
	var pyears;
	table a b c d e f ALL="TOTAL" ,  
			ALL="Total" *(pyears=" "*(sum="py"*f=8.0 colpctsum="%"*f=8.1)) g="exposure"*(pyears=" "*(sum="py"*f=8.0 colpctsum="%"*f=8.1)) ;
	keylabel sum=' ';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;Is this possible to do?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Feb 2026 19:01:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-tabulate-question-adding-cumulative-row-total/m-p/982873#M379404</guid>
      <dc:creator>sasgorilla</dc:creator>
      <dc:date>2026-02-02T19:01:57Z</dc:date>
    </item>
    <item>
      <title>Re: Proc tabulate question: adding cumulative row total</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-tabulate-question-adding-cumulative-row-total/m-p/982882#M379405</link>
      <description>&lt;P&gt;To get the desired percentages, you would have to restructure the table so that the sum and percent are stacked in the row dimension, rather than as columns in the column dimension. Here is an example.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc tabulate data=testtable order=data;
class  a b c d e f g /preloadfmt;
classlev  a b c d e f /s=[JUST=R];
var pyears;
*table a b c d e f ALL="TOTAL" ,
        ALL="Total" *(pyears=" "*(sum="py"*f=8.0 colpctsum="%"*f=8.1))
 g="exposure"*(pyears=" "*(sum="py"*f=8.0 colpctsum="%"*f=8.1)) ;
keylabel sum=' ';
table (a b)*pyears=' '*(sum="py"*f=8.0 colpctsum="%"*f=8.1)
 All='Total'*pyears=' '*(sum="py"*f=8.0 rowpctsum="%"*f=8.1),
 All='Total' g='exposure' / row=float;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 Feb 2026 20:09:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-tabulate-question-adding-cumulative-row-total/m-p/982882#M379405</guid>
      <dc:creator>Kathryn_SAS</dc:creator>
      <dc:date>2026-02-02T20:09:49Z</dc:date>
    </item>
    <item>
      <title>Re: Proc tabulate question: adding cumulative row total</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-tabulate-question-adding-cumulative-row-total/m-p/982908#M379412</link>
      <description>&lt;P&gt;You want this ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc tabulate data=sashelp.heart(obs=1000);
&lt;STRONG&gt;class status bp_status sex;&lt;/STRONG&gt;
var ageatstart;
table status bp_status all='Total',
 ALL="Total" *ageatstart=" "*(sum="py"*f=8.0 colpctsum="%"*f=8.1) 
 sex="exposure"*ageatstart=" "*(sum="py"*f=8.0 &lt;STRONG&gt;&lt;FONT color="#000000"&gt;pctsum&lt;/FONT&gt;&amp;lt;status bp_status sex&amp;gt;&lt;/STRONG&gt;="%"*f=8.1) ;
 keylabel sum=' ';
run;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1770104406879.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/112962i0F9D951C85C4CB33/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1770104406879.png" alt="Ksharp_0-1770104406879.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Feb 2026 07:44:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-tabulate-question-adding-cumulative-row-total/m-p/982908#M379412</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2026-02-03T07:44:52Z</dc:date>
    </item>
  </channel>
</rss>

