<?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 Total column in Proc Tabulate in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Total-column-in-Proc-Tabulate/m-p/392592#M19220</link>
    <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need some help with Proc Tabulate! &amp;nbsp;I hope you can help me because I'm pulling my hair out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to generate the table in the exact format as below:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SAS proc tab question1.JPG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/14786i9DC24A60425BFAD4/image-size/large?v=v2&amp;amp;px=999" role="button" title="SAS proc tab question1.JPG" alt="SAS proc tab question1.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can only figure out some of it. &amp;nbsp;Below is my code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc tabulate data=data.ads  FORMAT=9.0 order=formatted;
var FEMALE LATINO_FLAG AGE_25_OLDER HSGPA BESTSAT;
CLASS DIRECT_ADMIT;
table DIRECT_ADMIT ='' *(sum Mean*f=PERCENT9.1), FEMALE LATINO_FLAG AGE_25_OLDER
/ ROW=FLOAT RTS=22 MISSTEXT='-' ;
KEYWORD all / style=[bordertopcolor=black bordertopwidth=1 bordertopstyle=double font_weight=bold fontstyle=italic];
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since I can't share the data, I will use&amp;nbsp;sashelp.shoes as an example:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc tabulate data=sashelp.shoes;  
  where region in ('Asia', 'Canada') and product in ('Boot', 'Slipper');
  class product region;
  var sales returns stores inventory;
  table region * (sum mean),
        sales returns inventory stores;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm able to achieve something like below (see screen cap), but I&amp;nbsp;need to add:&lt;/P&gt;&lt;P&gt;- total column N&lt;/P&gt;&lt;P&gt;- total row N&lt;/P&gt;&lt;P&gt;- merged column heading&amp;nbsp;&lt;/P&gt;&lt;P&gt;- means columns at the end&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SAS proc tab question2.JPG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/14787i8A7547630770EA79/image-size/large?v=v2&amp;amp;px=999" role="button" title="SAS proc tab question2.JPG" alt="SAS proc tab question2.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Any help would be appreciated! Thank you!&lt;/P&gt;</description>
    <pubDate>Fri, 01 Sep 2017 16:29:27 GMT</pubDate>
    <dc:creator>lin39</dc:creator>
    <dc:date>2017-09-01T16:29:27Z</dc:date>
    <item>
      <title>Total column in Proc Tabulate</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Total-column-in-Proc-Tabulate/m-p/392592#M19220</link>
      <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need some help with Proc Tabulate! &amp;nbsp;I hope you can help me because I'm pulling my hair out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to generate the table in the exact format as below:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SAS proc tab question1.JPG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/14786i9DC24A60425BFAD4/image-size/large?v=v2&amp;amp;px=999" role="button" title="SAS proc tab question1.JPG" alt="SAS proc tab question1.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can only figure out some of it. &amp;nbsp;Below is my code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc tabulate data=data.ads  FORMAT=9.0 order=formatted;
var FEMALE LATINO_FLAG AGE_25_OLDER HSGPA BESTSAT;
CLASS DIRECT_ADMIT;
table DIRECT_ADMIT ='' *(sum Mean*f=PERCENT9.1), FEMALE LATINO_FLAG AGE_25_OLDER
/ ROW=FLOAT RTS=22 MISSTEXT='-' ;
KEYWORD all / style=[bordertopcolor=black bordertopwidth=1 bordertopstyle=double font_weight=bold fontstyle=italic];
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since I can't share the data, I will use&amp;nbsp;sashelp.shoes as an example:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc tabulate data=sashelp.shoes;  
  where region in ('Asia', 'Canada') and product in ('Boot', 'Slipper');
  class product region;
  var sales returns stores inventory;
  table region * (sum mean),
        sales returns inventory stores;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm able to achieve something like below (see screen cap), but I&amp;nbsp;need to add:&lt;/P&gt;&lt;P&gt;- total column N&lt;/P&gt;&lt;P&gt;- total row N&lt;/P&gt;&lt;P&gt;- merged column heading&amp;nbsp;&lt;/P&gt;&lt;P&gt;- means columns at the end&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SAS proc tab question2.JPG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/14787i8A7547630770EA79/image-size/large?v=v2&amp;amp;px=999" role="button" title="SAS proc tab question2.JPG" alt="SAS proc tab question2.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Any help would be appreciated! Thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 01 Sep 2017 16:29:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Total-column-in-Proc-Tabulate/m-p/392592#M19220</guid>
      <dc:creator>lin39</dc:creator>
      <dc:date>2017-09-01T16:29:27Z</dc:date>
    </item>
    <item>
      <title>Re: Total column in Proc Tabulate</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Total-column-in-Proc-Tabulate/m-p/392596#M19221</link>
      <description>&lt;P&gt;Proc tabulate really&amp;nbsp;doesn't do crossed statistics in a single table: row with mean or sum&amp;nbsp;and column of n for example. To stack vertical statistics as you show the sum and mean would have to remain in the row dimension as you show&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you need output that looks exactly like your output it may be possible with the Report Writing Interface which would require using other steps to summarize the data before display.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you were willing to accept the statistics all in column (&amp;nbsp; sum beside % instead of sum above % tabulate might be possible but would likely require some restructuring of your data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For tabulate to do a grouped header as you show you would want one variable as a class variable that has values (or formatted values)&amp;nbsp;of Male Latino and "Older than 25" similar to use of Product here:&lt;/P&gt;
&lt;PRE&gt;proc tabulate data=sashelp.shoes;  
  where region in ('Asia', 'Canada') and product in ('Boot', 'Slipper');
  class product region;
  var sales returns stores inventory;
  table region * (sum mean),
        product*(sales returns inventory stores);
run;&lt;/PRE&gt;
&lt;P&gt;Means as a column won't cross with sum and mean as row.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Sep 2017 17:07:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Total-column-in-Proc-Tabulate/m-p/392596#M19221</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-09-01T17:07:54Z</dc:date>
    </item>
  </channel>
</rss>

