<?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 ON MULTIPLE VARIABLES in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-GROUPING-ON-MULTIPLE-VARIABLES/m-p/521155#M22083</link>
    <description>&lt;P&gt;Input data and expected output will get much better answers. Right now we have to guess what actual output you want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your data is sensitive you could recast the problem using a SAS supplied data set such as SASHELP.CLASS. Possibly with Sex instead of Region and height or weight instead of amount (the set does have an age variable).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are asking for summary at the region level and a grand total maybe something along the lines of:&lt;/P&gt;
&lt;PRE&gt;PROC REPORT DATA = sashelp.class;
COLUMNS sex age weight;
define sex/ group;
define age / group;
 
break after sex/ summarize style={background=lightGrey font_Weight=Bold};
rbreak after/ summarize ;
run;&lt;/PRE&gt;
&lt;P&gt;If you don't want an age or sex (region) summary remove the break.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But we are &lt;STRONG&gt;guessing&lt;/STRONG&gt; what you want because you haven't shown the desired layout.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The missing semicolon on the COLUMNS statement would be an issue.&lt;/P&gt;</description>
    <pubDate>Thu, 13 Dec 2018 15:29:46 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2018-12-13T15:29:46Z</dc:date>
    <item>
      <title>PROC REPORT - GROUPING ON MULTIPLE VARIABLES</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-GROUPING-ON-MULTIPLE-VARIABLES/m-p/521055#M22077</link>
      <description>&lt;P&gt;Hello -&amp;nbsp; In my data set I have 3 columns. I need to group them based first 2 columns and display total How can this be done using PROC REPORT. I have written the code as mentioned below, but&amp;nbsp; observations are not grouped correctly.Thanks for your help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC REPORT DATA = MyData;&lt;/P&gt;&lt;P&gt;COLUMNS&amp;nbsp;region age amount&lt;/P&gt;&lt;P&gt;define region/ group;&lt;/P&gt;&lt;P&gt;define age / group;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;break after age/ summarize style={background=lightGrey font_Weight=Bold};&lt;/P&gt;</description>
      <pubDate>Thu, 13 Dec 2018 03:42:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-GROUPING-ON-MULTIPLE-VARIABLES/m-p/521055#M22077</guid>
      <dc:creator>DLROW</dc:creator>
      <dc:date>2018-12-13T03:42:13Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REPORT - GROUPING ON MULTIPLE VARIABLES</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-GROUPING-ON-MULTIPLE-VARIABLES/m-p/521073#M22078</link>
      <description>&lt;P&gt;Hello Dlrow,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; why you are not using region in break statement . I'm posting a simple example where i'm getting expected output. If it's not match your requirement , please share expected output.&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 test;
input region $ age amount;
cards;
asian 11 24
asian 12 22
asian 11 21
asian 12 21
asian 11 20
african 10 25
african 10 15
;
run;

PROC REPORT DATA = test;
COLUMNS region age amount;
define region/ group;
define age / group;
define amount/sum;
break after region / summarize style={background=lightGrey font_Weight=Bold};
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Dec 2018 07:10:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-GROUPING-ON-MULTIPLE-VARIABLES/m-p/521073#M22078</guid>
      <dc:creator>singhsahab</dc:creator>
      <dc:date>2018-12-13T07:10:32Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REPORT - GROUPING ON MULTIPLE VARIABLES</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-GROUPING-ON-MULTIPLE-VARIABLES/m-p/521102#M22079</link>
      <description>That's what I tried but all ages are grouped.. I Want to group ages in each group of region.</description>
      <pubDate>Thu, 13 Dec 2018 10:27:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-GROUPING-ON-MULTIPLE-VARIABLES/m-p/521102#M22079</guid>
      <dc:creator>DLROW</dc:creator>
      <dc:date>2018-12-13T10:27:45Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REPORT - GROUPING ON MULTIPLE VARIABLES</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-GROUPING-ON-MULTIPLE-VARIABLES/m-p/521103#M22080</link>
      <description>&lt;P&gt;Can you please share expected output ?&lt;/P&gt;</description>
      <pubDate>Thu, 13 Dec 2018 10:37:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-GROUPING-ON-MULTIPLE-VARIABLES/m-p/521103#M22080</guid>
      <dc:creator>singhsahab</dc:creator>
      <dc:date>2018-12-13T10:37:55Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REPORT - GROUPING ON MULTIPLE VARIABLES</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-GROUPING-ON-MULTIPLE-VARIABLES/m-p/521155#M22083</link>
      <description>&lt;P&gt;Input data and expected output will get much better answers. Right now we have to guess what actual output you want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your data is sensitive you could recast the problem using a SAS supplied data set such as SASHELP.CLASS. Possibly with Sex instead of Region and height or weight instead of amount (the set does have an age variable).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are asking for summary at the region level and a grand total maybe something along the lines of:&lt;/P&gt;
&lt;PRE&gt;PROC REPORT DATA = sashelp.class;
COLUMNS sex age weight;
define sex/ group;
define age / group;
 
break after sex/ summarize style={background=lightGrey font_Weight=Bold};
rbreak after/ summarize ;
run;&lt;/PRE&gt;
&lt;P&gt;If you don't want an age or sex (region) summary remove the break.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But we are &lt;STRONG&gt;guessing&lt;/STRONG&gt; what you want because you haven't shown the desired layout.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The missing semicolon on the COLUMNS statement would be an issue.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Dec 2018 15:29:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-GROUPING-ON-MULTIPLE-VARIABLES/m-p/521155#M22083</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-12-13T15:29:46Z</dc:date>
    </item>
  </channel>
</rss>

