<?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: re: proc tabulate subtotal &amp;amp; total in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/re-proc-tabulate-subtotal-amp-total/m-p/885951#M350090</link>
    <description>&lt;P&gt;Suggestion: For questions relating to calculation or content of reports providing a LOT of style overrides just makes code long.&lt;/P&gt;
&lt;P&gt;Providing data, or using a data set provided in the SASHELP library for examples is also helpful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See if this example helps. It uses a data set you should have available.&lt;/P&gt;
&lt;PRE&gt;proc tabulate data=sashelp.class;
   class age sex;
   var height;

   table (age all='overall total')*(sex all='Age total'),
         height *(n mean)
   ;
run;&lt;/PRE&gt;
&lt;P&gt;General idea is to include an All with a nested variable in parentheses to get the subtotals for the higher levels.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4061"&gt;@twildone&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi...I am trying to insert subtotals after each "Degree Original" and Totals after each School. I was able to get the Grand Total and tried to include "All" after "School" and "Degree Original" in the Table statement and it didn't work. Do I need to use parenthesis to group the variables. Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc tabulate data=List201 format=8.0 style=[bordercolor=black];	
    var StudentUID1 / style=[background=lightblue bordercolor=black];
    var 'Completion Status1'n / style=[background=lightblue bordercolor=black];
    var Graduation1 / style=[background=lightblue bordercolor=black];
	class Gender / style=[background=lightblue bordercolor=black] order=unformatted;
	class "Season Enrolled1"n /	style=[background=lightblue vjust=c bordercolor=black] order=unformatted;
	class School /	style=[background=lightblue vjust=c bordercolor=black] order=unformatted missing;
	class "Initial Program"n / style=[background=lightblue bordercolor=black] order=unformatted missing;
	class Level / style=[background=lightblue bordercolor=black] order=unformatted missing ;
	class Academic_Term / style=[background=lightblue bordercolor=black] order=unformatted missing;
    class 'Degree Original'n / style=[background=lightblue vjust=c bordercolor=black] order=unformatted missing;
    classlev Gender  / style=[background=lightblue bordercolor=black];
    classlev "Initial Program"n / style=[background=lightblue cellwidth=11.0cm vjust=c bordercolor=black];
    classlev Level / style=[background=lightblue cellwidth=3.0cm bordercolor=black];
    classlev "Season Enrolled1"n / style=[background=lightblue cellwidth=3.0cm vjust=c bordercolor=black];
    classlev School / style=[background=lightblue cellwidth=4.0cm vjust=c bordercolor=black];
    classlev Academic_Term / style=[background=lightblue cellwidth=3.0cm  vjust=c bordercolor=black];
    classlev 'Degree Original'n / style=[background=lightblue cellwidth=6.0cm vjust=c bordercolor=black];    

    table School= 'School' * "Degree Original"n='Credential' * "Initial Program"n='Program' * Level='Level' All ={ label='Grand Total' S=[background = lightblue bordercolor=black]} *[style=[bordercolor=black]] , ((StudentUID1='Students Enrolled' * Gender=' ' * Sum=' ' ) ("Season Enrolled1"n=' '  * Gender=' ' * N=' ' ) ('Completion Status1'n='On-Time Rate (%)' * Gender=' ' * (pctsum&amp;lt;Gender&amp;gt;=""*f=8.2) ) (Graduation1='Graduation Rate (%)' * Gender=' ' * (pctsum&amp;lt;Gender&amp;gt;=""*f=8.2) )) /  box=[label=' ' style=[backgroundcolor=lightblue cellwidth=10.0cm  bordercolor=black]];
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 22 Jul 2023 17:22:08 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2023-07-22T17:22:08Z</dc:date>
    <item>
      <title>re: proc tabulate subtotal &amp; total</title>
      <link>https://communities.sas.com/t5/SAS-Programming/re-proc-tabulate-subtotal-amp-total/m-p/885949#M350088</link>
      <description>&lt;P&gt;Hi...I am trying to insert subtotals after each "Degree Original" and Totals after each School. I was able to get the Grand Total and tried to include "All" after "School" and "Degree Original" in the Table statement and it didn't work. Do I need to use parenthesis to group the variables. Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc tabulate data=List201 format=8.0 style=[bordercolor=black];	
    var StudentUID1 / style=[background=lightblue bordercolor=black];
    var 'Completion Status1'n / style=[background=lightblue bordercolor=black];
    var Graduation1 / style=[background=lightblue bordercolor=black];
	class Gender / style=[background=lightblue bordercolor=black] order=unformatted;
	class "Season Enrolled1"n /	style=[background=lightblue vjust=c bordercolor=black] order=unformatted;
	class School /	style=[background=lightblue vjust=c bordercolor=black] order=unformatted missing;
	class "Initial Program"n / style=[background=lightblue bordercolor=black] order=unformatted missing;
	class Level / style=[background=lightblue bordercolor=black] order=unformatted missing ;
	class Academic_Term / style=[background=lightblue bordercolor=black] order=unformatted missing;
    class 'Degree Original'n / style=[background=lightblue vjust=c bordercolor=black] order=unformatted missing;
    classlev Gender  / style=[background=lightblue bordercolor=black];
    classlev "Initial Program"n / style=[background=lightblue cellwidth=11.0cm vjust=c bordercolor=black];
    classlev Level / style=[background=lightblue cellwidth=3.0cm bordercolor=black];
    classlev "Season Enrolled1"n / style=[background=lightblue cellwidth=3.0cm vjust=c bordercolor=black];
    classlev School / style=[background=lightblue cellwidth=4.0cm vjust=c bordercolor=black];
    classlev Academic_Term / style=[background=lightblue cellwidth=3.0cm  vjust=c bordercolor=black];
    classlev 'Degree Original'n / style=[background=lightblue cellwidth=6.0cm vjust=c bordercolor=black];    

    table School= 'School' * "Degree Original"n='Credential' * "Initial Program"n='Program' * Level='Level' All ={ label='Grand Total' S=[background = lightblue bordercolor=black]} *[style=[bordercolor=black]] , ((StudentUID1='Students Enrolled' * Gender=' ' * Sum=' ' ) ("Season Enrolled1"n=' '  * Gender=' ' * N=' ' ) ('Completion Status1'n='On-Time Rate (%)' * Gender=' ' * (pctsum&amp;lt;Gender&amp;gt;=""*f=8.2) ) (Graduation1='Graduation Rate (%)' * Gender=' ' * (pctsum&amp;lt;Gender&amp;gt;=""*f=8.2) )) /  box=[label=' ' style=[backgroundcolor=lightblue cellwidth=10.0cm  bordercolor=black]];
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 22 Jul 2023 16:42:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/re-proc-tabulate-subtotal-amp-total/m-p/885949#M350088</guid>
      <dc:creator>twildone</dc:creator>
      <dc:date>2023-07-22T16:42:04Z</dc:date>
    </item>
    <item>
      <title>Re: re: proc tabulate subtotal &amp; total</title>
      <link>https://communities.sas.com/t5/SAS-Programming/re-proc-tabulate-subtotal-amp-total/m-p/885951#M350090</link>
      <description>&lt;P&gt;Suggestion: For questions relating to calculation or content of reports providing a LOT of style overrides just makes code long.&lt;/P&gt;
&lt;P&gt;Providing data, or using a data set provided in the SASHELP library for examples is also helpful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See if this example helps. It uses a data set you should have available.&lt;/P&gt;
&lt;PRE&gt;proc tabulate data=sashelp.class;
   class age sex;
   var height;

   table (age all='overall total')*(sex all='Age total'),
         height *(n mean)
   ;
run;&lt;/PRE&gt;
&lt;P&gt;General idea is to include an All with a nested variable in parentheses to get the subtotals for the higher levels.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4061"&gt;@twildone&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi...I am trying to insert subtotals after each "Degree Original" and Totals after each School. I was able to get the Grand Total and tried to include "All" after "School" and "Degree Original" in the Table statement and it didn't work. Do I need to use parenthesis to group the variables. Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc tabulate data=List201 format=8.0 style=[bordercolor=black];	
    var StudentUID1 / style=[background=lightblue bordercolor=black];
    var 'Completion Status1'n / style=[background=lightblue bordercolor=black];
    var Graduation1 / style=[background=lightblue bordercolor=black];
	class Gender / style=[background=lightblue bordercolor=black] order=unformatted;
	class "Season Enrolled1"n /	style=[background=lightblue vjust=c bordercolor=black] order=unformatted;
	class School /	style=[background=lightblue vjust=c bordercolor=black] order=unformatted missing;
	class "Initial Program"n / style=[background=lightblue bordercolor=black] order=unformatted missing;
	class Level / style=[background=lightblue bordercolor=black] order=unformatted missing ;
	class Academic_Term / style=[background=lightblue bordercolor=black] order=unformatted missing;
    class 'Degree Original'n / style=[background=lightblue vjust=c bordercolor=black] order=unformatted missing;
    classlev Gender  / style=[background=lightblue bordercolor=black];
    classlev "Initial Program"n / style=[background=lightblue cellwidth=11.0cm vjust=c bordercolor=black];
    classlev Level / style=[background=lightblue cellwidth=3.0cm bordercolor=black];
    classlev "Season Enrolled1"n / style=[background=lightblue cellwidth=3.0cm vjust=c bordercolor=black];
    classlev School / style=[background=lightblue cellwidth=4.0cm vjust=c bordercolor=black];
    classlev Academic_Term / style=[background=lightblue cellwidth=3.0cm  vjust=c bordercolor=black];
    classlev 'Degree Original'n / style=[background=lightblue cellwidth=6.0cm vjust=c bordercolor=black];    

    table School= 'School' * "Degree Original"n='Credential' * "Initial Program"n='Program' * Level='Level' All ={ label='Grand Total' S=[background = lightblue bordercolor=black]} *[style=[bordercolor=black]] , ((StudentUID1='Students Enrolled' * Gender=' ' * Sum=' ' ) ("Season Enrolled1"n=' '  * Gender=' ' * N=' ' ) ('Completion Status1'n='On-Time Rate (%)' * Gender=' ' * (pctsum&amp;lt;Gender&amp;gt;=""*f=8.2) ) (Graduation1='Graduation Rate (%)' * Gender=' ' * (pctsum&amp;lt;Gender&amp;gt;=""*f=8.2) )) /  box=[label=' ' style=[backgroundcolor=lightblue cellwidth=10.0cm  bordercolor=black]];
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 22 Jul 2023 17:22:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/re-proc-tabulate-subtotal-amp-total/m-p/885951#M350090</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-07-22T17:22:08Z</dc:date>
    </item>
    <item>
      <title>Re: re: proc tabulate subtotal &amp; total</title>
      <link>https://communities.sas.com/t5/SAS-Programming/re-proc-tabulate-subtotal-amp-total/m-p/885954#M350092</link>
      <description>&lt;P&gt;Hi BallardW....nesting the variable in parenthesis was what was needed. It work now....thanks&lt;/P&gt;</description>
      <pubDate>Sat, 22 Jul 2023 17:46:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/re-proc-tabulate-subtotal-amp-total/m-p/885954#M350092</guid>
      <dc:creator>twildone</dc:creator>
      <dc:date>2023-07-22T17:46:49Z</dc:date>
    </item>
  </channel>
</rss>

