<?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 report partials sums in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-report-partials-sums/m-p/672577#M202144</link>
    <description>Ok, the result is the same I've would have with the use of the proc report... Sorry for the wrong data, I really need some holidays I suppose... &lt;span class="lia-unicode-emoji" title=":downcast_face_with_sweat:"&gt;😓&lt;/span&gt;</description>
    <pubDate>Mon, 27 Jul 2020 15:22:42 GMT</pubDate>
    <dc:creator>LukeL</dc:creator>
    <dc:date>2020-07-27T15:22:42Z</dc:date>
    <item>
      <title>proc report partials sums</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-report-partials-sums/m-p/672552#M202136</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;I have a dataset with some rows made this way:&lt;/P&gt;
&lt;PRE&gt;Group  Class  Subclass  Value
G1     A         A1            1
G1     A         A2            2
G1     A         A3            3
G1     B         B1            4
G1     C         C1            10
G1     C         C2            20
G1     D         D1            20
G1     E         E1            30&lt;BR /&gt;G2 ........&lt;/PRE&gt;
&lt;P&gt;What I need to do is a report (proc report?) made this way:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;             A      | B  |     C    | D  | E  |&lt;BR /&gt;Group   A1 A2 A3 AT | B1 | C1 C2 CT | D1 | E1 | T
G1      1  2  3  6  | 4  | 10 20 30 | 20 | 30 | 90&lt;BR /&gt;G2 ....&lt;BR /&gt;&lt;BR /&gt;where AT/CT are the totals for the classes A and C, while T would be the grandtotal for the entire group.&lt;/PRE&gt;
&lt;P&gt;I'm trying using the proc report, but not able to obtain the subtotals on rows for only gruops with more than one value... Any idea? Currently proc report is something like&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc report data=mydata missing;
    columns GROUP (CLASS,(SUBCLASS,VALUE) ('Subtotal' VALUE))  ('Total' VALUE=TOT);
    define group / group;
    define class / across '';
    define subclass / across '';
    define VALUE/ analysis '';
    define TOT/ analysis '';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;but in this ways all values in cols B* D* E* are duplicated...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jul 2020 15:23:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-report-partials-sums/m-p/672552#M202136</guid>
      <dc:creator>LukeL</dc:creator>
      <dc:date>2020-07-27T15:23:43Z</dc:date>
    </item>
    <item>
      <title>Re: proc report partials sums</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-report-partials-sums/m-p/672555#M202137</link>
      <description>&lt;P&gt;I would compute the cumulative sums in a data step, and then use PROC REPORT for the final report. That seems much easier to me.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jul 2020 14:44:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-report-partials-sums/m-p/672555#M202137</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-07-27T14:44:23Z</dc:date>
    </item>
    <item>
      <title>Re: proc report partials sums</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-report-partials-sums/m-p/672556#M202138</link>
      <description>&lt;P&gt;Yes, that would be my way, but that way I couldn't use across anymore, having to compute all the columns and list them on the report.... So was wondering if there was a more straightful way to le a proc (repoort/tabulate) do all he stuff... But probably not... &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jul 2020 14:53:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-report-partials-sums/m-p/672556#M202138</guid>
      <dc:creator>LukeL</dc:creator>
      <dc:date>2020-07-27T14:53:31Z</dc:date>
    </item>
    <item>
      <title>Re: proc report partials sums</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-report-partials-sums/m-p/672559#M202140</link>
      <description>&lt;P&gt;First start with representative data. Your desired output implies either a variable or something with the value G1 in the variable Group but you do not show it anywhere in your data.&lt;/P&gt;
&lt;P&gt;If AT is supposed to be the totals of the A values, say so, same with the C&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Probably any approach that works strictly within proc report will have a "total" for B,D and E as well. The proc does not have a lot of "condtionally create column" features&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jul 2020 14:53:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-report-partials-sums/m-p/672559#M202140</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-07-27T14:53:24Z</dc:date>
    </item>
    <item>
      <title>Re: proc report partials sums</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-report-partials-sums/m-p/672564#M202141</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;implies either a variable or something with the value G1 in the variable Group but you do not show it anywhere in your data.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If AT is supposed to be the totals of the A values, say so, same with the C&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Sorry, my mistake, forgot to put the gorup in the data, corrected the first post, and added the clarification for the partials AT and CT.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jul 2020 14:59:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-report-partials-sums/m-p/672564#M202141</guid>
      <dc:creator>LukeL</dc:creator>
      <dc:date>2020-07-27T14:59:26Z</dc:date>
    </item>
    <item>
      <title>Re: proc report partials sums</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-report-partials-sums/m-p/672572#M202143</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/58023"&gt;@LukeL&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;implies either a variable or something with the value G1 in the variable Group but you do not show it anywhere in your data.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If AT is supposed to be the totals of the A values, say so, same with the C&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Sorry, my mistake, forgot to put the gorup in the data, corrected the first post, and added the clarification for the partials AT and CT.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Now get your CLASS and SUBCLASS values to match your output. You have all of the example data with Class=A but show B1 as subordinate to a Class=B.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assuming the data actually looks more like this, then the result from Proc Tabulate is the closest I can get.&lt;/P&gt;
&lt;PRE&gt;data have;
 input Group $  Class $  Subclass $  Value;
datalines;
G1     A         A1            1
G1     A         A2            2
G1     A         A3            3
G1     B         B1            4
G1     C         C1            10
G1     C         C2            20
G1     D         D1            20
G1     E         E1            30
;

proc tabulate data=have;
   class group class subclass  ;
   var value;
   table group,
         (class*(subclass All='Group total') All='Total')
             *value=''*sum=''
         /
   ;
run;
&lt;/PRE&gt;</description>
      <pubDate>Mon, 27 Jul 2020 15:13:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-report-partials-sums/m-p/672572#M202143</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-07-27T15:13:32Z</dc:date>
    </item>
    <item>
      <title>Re: proc report partials sums</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-report-partials-sums/m-p/672577#M202144</link>
      <description>Ok, the result is the same I've would have with the use of the proc report... Sorry for the wrong data, I really need some holidays I suppose... &lt;span class="lia-unicode-emoji" title=":downcast_face_with_sweat:"&gt;😓&lt;/span&gt;</description>
      <pubDate>Mon, 27 Jul 2020 15:22:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-report-partials-sums/m-p/672577#M202144</guid>
      <dc:creator>LukeL</dc:creator>
      <dc:date>2020-07-27T15:22:42Z</dc:date>
    </item>
    <item>
      <title>Re: proc report partials sums</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-report-partials-sums/m-p/672800#M202247</link>
      <description>&lt;P&gt;ballardw&amp;nbsp; gave you right code. If you want PROC REPORT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data have;
 input Group $  Class $  Subclass $  Value;
datalines;
G1     A         A1            1
G1     A         A2            2
G1     A         A3            3
G1     B         B1            4
G1     C         C1            10
G1     C         C2            20
G1     D         D1            20
G1     E         E1            30
;
proc report data=have nowd;
columns Group   Class,(Subclass,Value  Value=v) Value=total;
define group/group;
define class/across ' ' nozero;
define Subclass/across ' ' nozero;
define value/analysis sum ' ' ;
define v/analysis sum 'total';
define total/analysis sum 'grand total';
run;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 Jul 2020 12:32:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-report-partials-sums/m-p/672800#M202247</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-07-28T12:32:19Z</dc:date>
    </item>
  </channel>
</rss>

