<?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: Using Proc Report to compute column percentages and a total on already aggregated data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Using-Proc-Report-to-compute-column-percentages-and-a-total-on/m-p/932670#M366897</link>
    <description>&lt;P&gt;Thanks for that, it worked.&amp;nbsp; I added the rbreak /summarize statement at the end of this, but I would like to have the label "Total" in that summary row in only the first column.&amp;nbsp; Is that possible?&amp;nbsp;&amp;nbsp;&amp;nbsp; I tried this, but obviously, it adds the label in each column.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;rbreak after/summarize style={pretext="Total"};&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Would also want the label to be indented to the left to align with values in Category. &lt;/P&gt;</description>
    <pubDate>Mon, 17 Jun 2024 15:30:13 GMT</pubDate>
    <dc:creator>RandoDando</dc:creator>
    <dc:date>2024-06-17T15:30:13Z</dc:date>
    <item>
      <title>Using Proc Report to compute column percentages and a total on already aggregated data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-Proc-Report-to-compute-column-percentages-and-a-total-on/m-p/932653#M366892</link>
      <description>&lt;P&gt;I have data which has already been aggregated like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 144pt;" border="0" width="192" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="64" height="20" style="height: 15.0pt; width: 48pt;"&gt;Category&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;Groups&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;People&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" style="height: 15.0pt;"&gt;A&lt;/TD&gt;
&lt;TD align="right"&gt;23&lt;/TD&gt;
&lt;TD align="right"&gt;235&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" style="height: 15.0pt;"&gt;B&lt;/TD&gt;
&lt;TD align="right"&gt;45&lt;/TD&gt;
&lt;TD align="right"&gt;754&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" style="height: 15.0pt;"&gt;C&lt;/TD&gt;
&lt;TD align="right"&gt;12&lt;/TD&gt;
&lt;TD align="right"&gt;89&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And I want something like this (prefer Proc Report for the bells and whistles)&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 240pt;" border="0" width="320" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="64" height="20" style="height: 15.0pt; width: 48pt;"&gt;Category&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;Groups&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;Groups Percent&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;People&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;People Percent&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" style="height: 15.0pt;"&gt;A&lt;/TD&gt;
&lt;TD align="right"&gt;23&lt;/TD&gt;
&lt;TD align="right" class="xl65"&gt;28.8%&lt;/TD&gt;
&lt;TD align="right"&gt;235&lt;/TD&gt;
&lt;TD align="right" class="xl65"&gt;21.8%&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" style="height: 15.0pt;"&gt;B&lt;/TD&gt;
&lt;TD align="right"&gt;45&lt;/TD&gt;
&lt;TD align="right" class="xl65"&gt;56.3%&lt;/TD&gt;
&lt;TD align="right"&gt;754&lt;/TD&gt;
&lt;TD align="right" class="xl65"&gt;69.9%&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" style="height: 15.0pt;"&gt;C&lt;/TD&gt;
&lt;TD align="right"&gt;12&lt;/TD&gt;
&lt;TD align="right" class="xl65"&gt;15.0%&lt;/TD&gt;
&lt;TD align="right"&gt;89&lt;/TD&gt;
&lt;TD align="right" class="xl65"&gt;8.3%&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl66" style="height: 15.0pt;"&gt;Total&lt;/TD&gt;
&lt;TD align="right" class="xl66"&gt;80&lt;/TD&gt;
&lt;TD align="right" class="xl67"&gt;100.0%&lt;/TD&gt;
&lt;TD align="right" class="xl66"&gt;1078&lt;/TD&gt;
&lt;TD align="right" class="xl67"&gt;100.0%&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;All the examples I can find online seem to use dis-aggregated data.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2024 14:47:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-Proc-Report-to-compute-column-percentages-and-a-total-on/m-p/932653#M366892</guid>
      <dc:creator>RandoDando</dc:creator>
      <dc:date>2024-06-17T14:47:45Z</dc:date>
    </item>
    <item>
      <title>Re: Using Proc Report to compute column percentages and a total on already aggregated data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-Proc-Report-to-compute-column-percentages-and-a-total-on/m-p/932663#M366896</link>
      <description>&lt;P&gt;To get multiple statistics from a single variable repeat it with a new column name and then request the statistic:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data have;
   input Category $	Groups 	People;
datalines;
A 	23 	235
B 	45 	754
C 	12 	89
;

proc report data=have;
   columns category groups groups=grouppct people people=peoplepct;
   define category /group;
   define groups/ analysis sum;
   define grouppct /analysis pctsum;
   define people/ analysis sum;
   define peoplepct/ analysis pctsum;
run;&lt;/PRE&gt;
&lt;P&gt;However if you want anything that measures dispersion such as standard deviation or range of value you would want to use disaggregated data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/264750"&gt;@RandoDando&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have data which has already been aggregated like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 144pt;" border="0" width="192" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="64" height="20" style="height: 15.0pt; width: 48pt;"&gt;Category&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;Groups&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;People&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" style="height: 15.0pt;"&gt;A&lt;/TD&gt;
&lt;TD align="right"&gt;23&lt;/TD&gt;
&lt;TD align="right"&gt;235&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" style="height: 15.0pt;"&gt;B&lt;/TD&gt;
&lt;TD align="right"&gt;45&lt;/TD&gt;
&lt;TD align="right"&gt;754&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" style="height: 15.0pt;"&gt;C&lt;/TD&gt;
&lt;TD align="right"&gt;12&lt;/TD&gt;
&lt;TD align="right"&gt;89&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And I want something like this (prefer Proc Report for the bells and whistles)&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 240pt;" border="0" width="320" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="64" height="20" style="height: 15.0pt; width: 48pt;"&gt;Category&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;Groups&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;Groups Percent&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;People&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;People Percent&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" style="height: 15.0pt;"&gt;A&lt;/TD&gt;
&lt;TD align="right"&gt;23&lt;/TD&gt;
&lt;TD align="right" class="xl65"&gt;28.8%&lt;/TD&gt;
&lt;TD align="right"&gt;235&lt;/TD&gt;
&lt;TD align="right" class="xl65"&gt;21.8%&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" style="height: 15.0pt;"&gt;B&lt;/TD&gt;
&lt;TD align="right"&gt;45&lt;/TD&gt;
&lt;TD align="right" class="xl65"&gt;56.3%&lt;/TD&gt;
&lt;TD align="right"&gt;754&lt;/TD&gt;
&lt;TD align="right" class="xl65"&gt;69.9%&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" style="height: 15.0pt;"&gt;C&lt;/TD&gt;
&lt;TD align="right"&gt;12&lt;/TD&gt;
&lt;TD align="right" class="xl65"&gt;15.0%&lt;/TD&gt;
&lt;TD align="right"&gt;89&lt;/TD&gt;
&lt;TD align="right" class="xl65"&gt;8.3%&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl66" style="height: 15.0pt;"&gt;Total&lt;/TD&gt;
&lt;TD align="right" class="xl66"&gt;80&lt;/TD&gt;
&lt;TD align="right" class="xl67"&gt;100.0%&lt;/TD&gt;
&lt;TD align="right" class="xl66"&gt;1078&lt;/TD&gt;
&lt;TD align="right" class="xl67"&gt;100.0%&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;All the examples I can find online seem to use dis-aggregated data.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2024 15:11:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-Proc-Report-to-compute-column-percentages-and-a-total-on/m-p/932663#M366896</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-06-17T15:11:20Z</dc:date>
    </item>
    <item>
      <title>Re: Using Proc Report to compute column percentages and a total on already aggregated data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-Proc-Report-to-compute-column-percentages-and-a-total-on/m-p/932670#M366897</link>
      <description>&lt;P&gt;Thanks for that, it worked.&amp;nbsp; I added the rbreak /summarize statement at the end of this, but I would like to have the label "Total" in that summary row in only the first column.&amp;nbsp; Is that possible?&amp;nbsp;&amp;nbsp;&amp;nbsp; I tried this, but obviously, it adds the label in each column.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;rbreak after/summarize style={pretext="Total"};&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Would also want the label to be indented to the left to align with values in Category. &lt;/P&gt;</description>
      <pubDate>Mon, 17 Jun 2024 15:30:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-Proc-Report-to-compute-column-percentages-and-a-total-on/m-p/932670#M366897</guid>
      <dc:creator>RandoDando</dc:creator>
      <dc:date>2024-06-17T15:30:13Z</dc:date>
    </item>
    <item>
      <title>Re: Using Proc Report to compute column percentages and a total on already aggregated data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-Proc-Report-to-compute-column-percentages-and-a-total-on/m-p/932683#M366898</link>
      <description>&lt;P&gt;Nevermind.&amp;nbsp; I got it.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Compute after;
Category = "Total";
endcomp;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 17 Jun 2024 15:35:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-Proc-Report-to-compute-column-percentages-and-a-total-on/m-p/932683#M366898</guid>
      <dc:creator>RandoDando</dc:creator>
      <dc:date>2024-06-17T15:35:34Z</dc:date>
    </item>
  </channel>
</rss>

