<?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 - Total sum in last column in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Total-sum-in-last-column/m-p/569704#M75215</link>
    <description>&lt;P&gt;All 3 solutions work well. Thank you so much for your ideas.&lt;/P&gt;&lt;P&gt;Much thanks!&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/212247"&gt;@koyelghosh&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 28 Jun 2019 05:57:49 GMT</pubDate>
    <dc:creator>Sathish_jammy</dc:creator>
    <dc:date>2019-06-28T05:57:49Z</dc:date>
    <item>
      <title>Proc Tabulate - Total sum in last column</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Total-sum-in-last-column/m-p/569343#M75201</link>
      <description>&lt;P&gt;Hi experts,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I trying to sum up my analysis table using Proc Tabulate. Kindly gothrough the given sample method in detail.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to sum up the Gender variable at the end of OP.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Type$ Grp$ Sex$;
cards;
1 G F
1 G M
3 O F
3 P M
3 G F
4 P M
7 G M
7 G F
;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc tabulate data = have;
class Type Grp Sex;
tables Type, Grp*Sex ALL;
keylabel n=' ';
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="imgss.jpg" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30588i8F67E15F1DEF1A01/image-size/large?v=v2&amp;amp;px=999" role="button" title="imgss.jpg" alt="imgss.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The result shares the perfect OP values but I required it in the right side displayed tabular format.&lt;/P&gt;&lt;P&gt;Please help me to sum up the Sex variable as the last column in the table. I tried a lot but nothing works well.&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2019 07:03:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Total-sum-in-last-column/m-p/569343#M75201</guid>
      <dc:creator>Sathish_jammy</dc:creator>
      <dc:date>2019-06-27T07:03:52Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate - Total sum in last column</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Total-sum-in-last-column/m-p/569382#M75202</link>
      <description>Will it matter if you achieve the same result with PROC REPORT instead of PROC TABULATE?</description>
      <pubDate>Thu, 27 Jun 2019 11:03:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Total-sum-in-last-column/m-p/569382#M75202</guid>
      <dc:creator>koyelghosh</dc:creator>
      <dc:date>2019-06-27T11:03:27Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate - Total sum in last column</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Total-sum-in-last-column/m-p/569391#M75203</link>
      <description>&lt;P&gt;No issues &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/212247"&gt;@koyelghosh&lt;/a&gt;&amp;nbsp;, Kindly share the details.&lt;/P&gt;&lt;P&gt;Much Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2019 12:09:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Total-sum-in-last-column/m-p/569391#M75203</guid>
      <dc:creator>Sathish_jammy</dc:creator>
      <dc:date>2019-06-27T12:09:53Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate - Total sum in last column</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Total-sum-in-last-column/m-p/569394#M75204</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Type$ Grp$ Sex$;
cards;
1 G F
1 G M
3 O F
3 P M
3 G F
4 P M
7 G M
7 G F
;
proc freq data=have noprint;
table type*grp*sex/out=level sparse list;
run;
proc tabulate data = have classdata=level;
class Type Grp ;
class Sex/order=internal descending;
tables Type=' ', (Grp=' ' ALL)*Sex=' '/box='Type';
keylabel n=' ';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 Jun 2019 12:22:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Total-sum-in-last-column/m-p/569394#M75204</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-06-27T12:22:56Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate - Total sum in last column</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Total-sum-in-last-column/m-p/569404#M75205</link>
      <description>&lt;P&gt;Try this .. formatting is not exactly correct.. but it is close.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC REPORT DATA=have;
	COLUMNS Type (Grp , Sex) ('Total' Sex=Sex_Total);
	DEFINE Type / GROUP;
	DEFINE Grp / ACROSS;
	DEFINE Sex / ACROSS;
	DEFINE Sex_Total / ACROSS;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The output is as below&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Output" style="width: 235px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30595iF5613565F889C1AF/image-size/large?v=v2&amp;amp;px=999" role="button" title="Output.png" alt="Output" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Output&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Let me know if this is what you wanted.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2019 12:49:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Total-sum-in-last-column/m-p/569404#M75205</guid>
      <dc:creator>koyelghosh</dc:creator>
      <dc:date>2019-06-27T12:49:12Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate - Total sum in last column</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Total-sum-in-last-column/m-p/569456#M75206</link>
      <description>&lt;P&gt;Please consider:&lt;/P&gt;
&lt;PRE&gt;data have;
input Type$ Grp$ Sex$;
cards;
1 G F
1 G M
3 O F
3 P M
3 G F
4 P M
7 G M
7 G F
;
proc sort data=have;
  by descending sex;
run;
proc tabulate data = have;
class Type Grp ;
class Sex /order=data;
tables Type, 
      (Grp all='Total')*Sex=' ' 
      /misstext=' '
;
keylabel n=' ';
run;
&lt;/PRE&gt;
&lt;P&gt;The ALL would as a minimum need to nest with SEX to get the desired totals. The way&amp;nbsp;shown is one way to do that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second is to get order of categorical text values can be very problematic as the default order will be FORMATTED and you may have issues getting a SORT order for character values as needed. In this case we could use a sort to get the only "problem" variable Sex and use the Order=data option. More complex order combinations may not work with character values. You've been warned.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2019 17:48:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Total-sum-in-last-column/m-p/569456#M75206</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-06-27T17:48:16Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Tabulate - Total sum in last column</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Total-sum-in-last-column/m-p/569704#M75215</link>
      <description>&lt;P&gt;All 3 solutions work well. Thank you so much for your ideas.&lt;/P&gt;&lt;P&gt;Much thanks!&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/212247"&gt;@koyelghosh&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2019 05:57:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Tabulate-Total-sum-in-last-column/m-p/569704#M75215</guid>
      <dc:creator>Sathish_jammy</dc:creator>
      <dc:date>2019-06-28T05:57:49Z</dc:date>
    </item>
  </channel>
</rss>

