<?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 grouping twice in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-report-grouping-twice/m-p/407152#M19680</link>
    <description>&lt;P&gt;This can be done with Proc REPORT, you do need to add a dummy content column for the first summarized var.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code below shows an example, please note that there are some additional statements, that where added for verification of the result.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data cars;
  set sashelp.cars;
  hpg = 1;
run;
proc report data=cars spanrows;
  column origin hpg horsepower=hpsum type invoice cylinders _dummy;
  define origin / group style={textalign=center VERTICALALIGN=MIDDLE };
  define hpg / group style={textalign=center VERTICALALIGN=MIDDLE };
  define hpsum / analysis sum
/*    noprint*/
  ;
  define type / group;
  define cylinders / analysis;
  define invoice / analysis;
  define _dummy / computed
/*    noprint*/
  ;

  compute before origin;
     tempHpg = hpsum;
  endcomp;

  /* assign value to grouping var */
  compute _dummy;
    /* just for verification */
    _dummy = tempHpg;
    hpg = tempHpg;
  endcomp;

  /* just for validation */
  break after origin / summarize;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 25 Oct 2017 08:01:08 GMT</pubDate>
    <dc:creator>BrunoMueller</dc:creator>
    <dc:date>2017-10-25T08:01:08Z</dc:date>
    <item>
      <title>Proc report grouping twice</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-report-grouping-twice/m-p/407142#M19679</link>
      <description>&lt;DIV class="lia-message-body"&gt;&lt;DIV class="lia-message-body-content"&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;could anyone please tell me if is it possible to group over one variable and then use another group&amp;nbsp; in same table.&lt;/P&gt;&lt;P&gt;I would like to obtain results like that:&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" style="width: 254px;"&gt;&lt;SPAN class="lia-message-image-wrapper"&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/16170iAE3F2C5781B432FB/image-size/large?v=1.0&amp;amp;px=600" alt="group variable.png" title="group variable.png" border="0" /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;GroupVar1 - first level grouping variable&lt;/P&gt;&lt;P&gt;Var2 - sum of var2 in datasets grouped by GroupVar1&lt;/P&gt;&lt;P&gt;GroupVar3 - second level grouping variable&lt;/P&gt;&lt;P&gt;Var4, Var5 - sum of variables grouped by GroupVar1&amp;nbsp; and GroupVar3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 25 Oct 2017 07:26:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-report-grouping-twice/m-p/407142#M19679</guid>
      <dc:creator>Matt3</dc:creator>
      <dc:date>2017-10-25T07:26:21Z</dc:date>
    </item>
    <item>
      <title>Re: Proc report grouping twice</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-report-grouping-twice/m-p/407152#M19680</link>
      <description>&lt;P&gt;This can be done with Proc REPORT, you do need to add a dummy content column for the first summarized var.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code below shows an example, please note that there are some additional statements, that where added for verification of the result.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data cars;
  set sashelp.cars;
  hpg = 1;
run;
proc report data=cars spanrows;
  column origin hpg horsepower=hpsum type invoice cylinders _dummy;
  define origin / group style={textalign=center VERTICALALIGN=MIDDLE };
  define hpg / group style={textalign=center VERTICALALIGN=MIDDLE };
  define hpsum / analysis sum
/*    noprint*/
  ;
  define type / group;
  define cylinders / analysis;
  define invoice / analysis;
  define _dummy / computed
/*    noprint*/
  ;

  compute before origin;
     tempHpg = hpsum;
  endcomp;

  /* assign value to grouping var */
  compute _dummy;
    /* just for verification */
    _dummy = tempHpg;
    hpg = tempHpg;
  endcomp;

  /* just for validation */
  break after origin / summarize;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Oct 2017 08:01:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Proc-report-grouping-twice/m-p/407152#M19680</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2017-10-25T08:01:08Z</dc:date>
    </item>
  </channel>
</rss>

