<?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 with 4 class vars and problem to get total in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-tabulate-with-4-class-vars-and-problem-to-get-total/m-p/645200#M192840</link>
    <description>&lt;P&gt;Very nice solution!!!&lt;/P&gt;
&lt;P&gt;Thank you so much!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 05 May 2020 09:06:37 GMT</pubDate>
    <dc:creator>Ronein</dc:creator>
    <dc:date>2020-05-05T09:06:37Z</dc:date>
    <item>
      <title>proc tabulate with 4 class vars and problem to get total</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-tabulate-with-4-class-vars-and-problem-to-get-total/m-p/645167#M192826</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I am using proc tabulate to create a 2 dimensional summary report.&lt;/P&gt;
&lt;P&gt;There are 4 class vars and 2 analysis vars.&lt;/P&gt;
&lt;P&gt;I want to have a Total row for each Z1 level so in the output&amp;nbsp; I want to get 2 total rows (because there are 2&amp;nbsp; levels for Z1).&lt;/P&gt;
&lt;P&gt;The rows in the output will be:&lt;/P&gt;
&lt;P&gt;a Carrot Q&lt;/P&gt;
&lt;P&gt;a Flowers T&lt;/P&gt;
&lt;P&gt;a Orange S&lt;/P&gt;
&lt;P&gt;Total (It means Total of a)&lt;/P&gt;
&lt;P&gt;b Carrot Q&lt;/P&gt;
&lt;P&gt;b Flowers T&lt;/P&gt;
&lt;P&gt;b Orange S&lt;/P&gt;
&lt;P&gt;Total (It means total of b)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I added "ALL" keyword after Z1 but the result was different than I wanted.&lt;/P&gt;
&lt;P&gt;What is the way to solve it please?&lt;/P&gt;
&lt;P&gt;Thank you so much&lt;/P&gt;
&lt;P&gt;Jo&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data Rawtbl;
input ID Z1 $ Z2 $ Z3 $ Z4 Y1 Y2;
cards;
1 a Flowers T 2019 100 1
2 b Flowers T 2019 90 1
3 a Flowers T 2018 70 1
4 a Orange S 2019 40 0
5 a Orange S 2018 30 0
6 b Orange S  2018 120 0
7 b Orange S 2018 75 0
8 b Carrot Q 2019 150 0
9 a Carrot Q 2019 90 0
10 b Carrot Q 2018 50 0
;
run;

proc tabulate data=Rawtbl format=comma8.  missing;
 class z1 z2 z3 z4;
var Y1 Y2;
table (Z1=''  ALL) *(Z2='')*(Z3=''), (Z4='')*(Y1='')*(N='customers' sum='Total Y1') (Y2=''*max='max Y2')/box='Z1/Z2/Z3';
Run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 May 2020 05:34:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-tabulate-with-4-class-vars-and-problem-to-get-total/m-p/645167#M192826</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2020-05-05T05:34:29Z</dc:date>
    </item>
    <item>
      <title>Re: proc tabulate with 4 class vars and problem to get total</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-tabulate-with-4-class-vars-and-problem-to-get-total/m-p/645169#M192828</link>
      <description>&lt;P&gt;&lt;EM&gt;&amp;gt;&amp;nbsp;Total row for each Z1 level&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;If you want a total for each Z1, you want to sum the Z2s.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;table (Z1='') *(Z2='' ALL)*(Z3=''), (Z4='')*(Y1='')*(N='customers' sum='Total Y1') (Y2=''*max='max Y2')/box='Z1/Z2/Z3';
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2020 05:51:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-tabulate-with-4-class-vars-and-problem-to-get-total/m-p/645169#M192828</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-05-05T05:51:26Z</dc:date>
    </item>
    <item>
      <title>Re: proc tabulate with 4 class vars and problem to get total</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-tabulate-with-4-class-vars-and-problem-to-get-total/m-p/645171#M192830</link>
      <description>&lt;P&gt;Please count how many rows you got in the output.&lt;/P&gt;
&lt;P&gt;IT is not what I wanted.&lt;/P&gt;
&lt;P&gt;I want to get 8 rows&lt;/P&gt;
&lt;P&gt;a Carrot Q&lt;/P&gt;
&lt;P&gt;a Flowers T&lt;/P&gt;
&lt;P&gt;a Orange&amp;nbsp; S&lt;/P&gt;
&lt;P&gt;Total a&lt;/P&gt;
&lt;P&gt;b carrot Q&lt;/P&gt;
&lt;P&gt;b Flowers T&lt;/P&gt;
&lt;P&gt;b Orange S&lt;/P&gt;
&lt;P&gt;Total b&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2020 06:05:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-tabulate-with-4-class-vars-and-problem-to-get-total/m-p/645171#M192830</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2020-05-05T06:05:50Z</dc:date>
    </item>
    <item>
      <title>Re: proc tabulate with 4 class vars and problem to get total</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-tabulate-with-4-class-vars-and-problem-to-get-total/m-p/645191#M192838</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc tabulate data=Rawtbl format=comma8.  missing;
	class z1 z2 z3 z4;
	var Y1 Y2;
	table (Z1='')*((Z2='')*(Z3='') (ALL)),
		  (Z4='')*(Y1='')*(N='customers' sum='Total Y1') (Y2=''*max='max Y2')/ box='Z1/Z2/Z3';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Output:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture d’écran 2020-05-05 à 10.04.37.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/39055i9F83F3C00AC7D092/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Capture d’écran 2020-05-05 à 10.04.37.png" alt="Capture d’écran 2020-05-05 à 10.04.37.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt; Best,&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2020 08:05:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-tabulate-with-4-class-vars-and-problem-to-get-total/m-p/645191#M192838</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-05-05T08:05:07Z</dc:date>
    </item>
    <item>
      <title>Re: proc tabulate with 4 class vars and problem to get total</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-tabulate-with-4-class-vars-and-problem-to-get-total/m-p/645200#M192840</link>
      <description>&lt;P&gt;Very nice solution!!!&lt;/P&gt;
&lt;P&gt;Thank you so much!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2020 09:06:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-tabulate-with-4-class-vars-and-problem-to-get-total/m-p/645200#M192840</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2020-05-05T09:06:37Z</dc:date>
    </item>
    <item>
      <title>Re: proc tabulate with 4 class vars and problem to get total</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-tabulate-with-4-class-vars-and-problem-to-get-total/m-p/645201#M192841</link>
      <description>Thank you &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt;&lt;BR /&gt;Have a lovely day</description>
      <pubDate>Tue, 05 May 2020 09:08:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-tabulate-with-4-class-vars-and-problem-to-get-total/m-p/645201#M192841</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-05-05T09:08:34Z</dc:date>
    </item>
  </channel>
</rss>

