<?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, subtotal with multiple levels in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-tabulate-subtotal-with-multiple-levels/m-p/897962#M82982</link>
    <description>&lt;P&gt;I want to clearify that Variable1 has more than 1 value&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FilipAxelsson_0-1696945576617.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/88743i30196C7C40C10614/image-size/medium?v=v2&amp;amp;px=400" role="button" title="FilipAxelsson_0-1696945576617.png" alt="FilipAxelsson_0-1696945576617.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 10 Oct 2023 13:46:40 GMT</pubDate>
    <dc:creator>FilipAxelsson</dc:creator>
    <dc:date>2023-10-10T13:46:40Z</dc:date>
    <item>
      <title>Proc tabulate, subtotal with multiple levels</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-tabulate-subtotal-with-multiple-levels/m-p/897959#M82981</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;Is it possible to create a subtotal when using proc tabulate and having more than two variables.&amp;nbsp; I want the result showed in the picture below.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My code that im working with is the following:&lt;/P&gt;
&lt;DIV&gt;&lt;STRONG&gt;PROC TABULATE DATA=my_df;&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;STRONG&gt;&amp;nbsp; CLASS&amp;nbsp; Variable1 Variable2 Variable3;&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;STRONG&gt;&amp;nbsp; VAR Response_variable;&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;STRONG&gt;&amp;nbsp; TABLE&amp;nbsp; (Variable1 all) * ( Variable2 * Variable3),&amp;nbsp; Response_variable*(SUM=' ');&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;STRONG&gt;RUN;&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However that code doesn't provide the result i want, once again i want it on the format that can be seen in the picture below.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FilipAxelsson_0-1696945630945.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/88744i9DDF0D8DDADB593D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="FilipAxelsson_0-1696945630945.png" alt="FilipAxelsson_0-1696945630945.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2023 13:47:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-tabulate-subtotal-with-multiple-levels/m-p/897959#M82981</guid>
      <dc:creator>FilipAxelsson</dc:creator>
      <dc:date>2023-10-10T13:47:22Z</dc:date>
    </item>
    <item>
      <title>Re: Proc tabulate, subtotal with multiple levels</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-tabulate-subtotal-with-multiple-levels/m-p/897962#M82982</link>
      <description>&lt;P&gt;I want to clearify that Variable1 has more than 1 value&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FilipAxelsson_0-1696945576617.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/88743i30196C7C40C10614/image-size/medium?v=v2&amp;amp;px=400" role="button" title="FilipAxelsson_0-1696945576617.png" alt="FilipAxelsson_0-1696945576617.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2023 13:46:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-tabulate-subtotal-with-multiple-levels/m-p/897962#M82982</guid>
      <dc:creator>FilipAxelsson</dc:creator>
      <dc:date>2023-10-10T13:46:40Z</dc:date>
    </item>
    <item>
      <title>Re: Proc tabulate, subtotal with multiple levels</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-tabulate-subtotal-with-multiple-levels/m-p/897964#M82983</link>
      <description>&lt;P&gt;The general rule for "All" with subgroups is to use it with the lower level. See the result&amp;nbsp; of running the code below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;PROC TABULATE DATA=my_df;
  CLASS  Variable1 Variable2 Variable3;
  VAR Response_variable;
  TABLE  (Variable1 all='ALL records') * ( Variable2 All='All Var1') * (Variable3 all='All Var2'),  Response_variable*(SUM=' ');
RUN;

 &lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Oct 2023 14:07:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-tabulate-subtotal-with-multiple-levels/m-p/897964#M82983</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-10-10T14:07:49Z</dc:date>
    </item>
    <item>
      <title>Re: Proc tabulate, subtotal with multiple levels</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-tabulate-subtotal-with-multiple-levels/m-p/898055#M82984</link>
      <description>&lt;P&gt;When im using that code i get the following result. Which doesnt calculate a subtotal, the only column that has a subtotal is C. Is there another way to create a crosstab with subtotals in the way i want it? (Picture in the first post)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FilipAxelsson_0-1697005433560.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/88756i25FE5C17E4FB9263/image-size/medium?v=v2&amp;amp;px=400" role="button" title="FilipAxelsson_0-1697005433560.png" alt="FilipAxelsson_0-1697005433560.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Oct 2023 06:25:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-tabulate-subtotal-with-multiple-levels/m-p/898055#M82984</guid>
      <dc:creator>FilipAxelsson</dc:creator>
      <dc:date>2023-10-11T06:25:54Z</dc:date>
    </item>
    <item>
      <title>Re: Proc tabulate, subtotal with multiple levels</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-tabulate-subtotal-with-multiple-levels/m-p/898061#M82985</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/438558"&gt;@FilipAxelsson&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;When im using that code i get the following result. Which doesnt calculate a subtotal, the only column that has a subtotal is C. Is there another way to create a crosstab with subtotals in the way i want it? (Picture in the first post)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FilipAxelsson_0-1697005433560.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/88756i25FE5C17E4FB9263/image-size/medium?v=v2&amp;amp;px=400" role="button" title="FilipAxelsson_0-1697005433560.png" alt="FilipAxelsson_0-1697005433560.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The code was to show where the ALL goes with a label that shows in the output and how the nesting of Tabulate works.&lt;/P&gt;
&lt;P&gt;If you nest a variable to the right of an ALL you get those subgroups, you don't get to "skip" them. That is not a tabulate feature.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What you want is likely not going to come from Tabulate.&lt;/P&gt;
&lt;P&gt;Consider this Proc Report though (and notice that I use a SAS data set that you have so can actually test code SASHELP.CARS is one of the sets SAS supplies for training in your install).&lt;/P&gt;
&lt;PRE&gt;proc report data=sashelp.cars spanrows;
   where make in ('Acura' 'Audi' 'BMW');
   columns make type cylinders mpg_city;
   define make /group;
   define type/group ;
   define cylinders/group;
   define mpg_city/ mean;
   break after make/summarize;
run;&lt;/PRE&gt;</description>
      <pubDate>Wed, 11 Oct 2023 07:05:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-tabulate-subtotal-with-multiple-levels/m-p/898061#M82985</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-10-11T07:05:24Z</dc:date>
    </item>
  </channel>
</rss>

