<?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: sum ,count,PCT count,PCT sum in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-report-sum-count-PCT-count-PCT-sum/m-p/592031#M169705</link>
    <description>&lt;P&gt;Can you please show the code with "column region sales&lt;FONT size="4"&gt;&lt;STRONG&gt;&lt;FONT color="#ff00ff"&gt;,&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;(n sum pctn pctsum);"?&lt;/P&gt;
&lt;P&gt;I want to see if it works and also to see the difference in comparison to the code you provided before&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 26 Sep 2019 21:04:52 GMT</pubDate>
    <dc:creator>Ronein</dc:creator>
    <dc:date>2019-09-26T21:04:52Z</dc:date>
    <item>
      <title>proc report: sum ,count,PCT count,PCT sum</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-report-sum-count-PCT-count-PCT-sum/m-p/591777#M169585</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;From data set sashep.shoes I want to calculate for each "Region" the following 4 statistics:&lt;/P&gt;
&lt;P&gt;sum&amp;nbsp; of sales&lt;BR /&gt;count&amp;nbsp; (number of rows)&lt;BR /&gt;percent of sum_sales from Total_sales&lt;BR /&gt;percent of counts from Total_count&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code is not correct.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc report data=sashelp.shoes;
column region,sales(n sum  pctn pctsum);
define region /group style(column)=header;
define sales/sum;
define sales/ N 'count' f=comma6.;
define sales/sum 'sum_sales' f=dollar15.;
define sales/pctn  'percent from total counts' f=percent9.2;
define sales/ pctsum'percent from total sum_sales' f=percent9.2;

rbreak after /summarize  style (summary)=Header;
compute after;
region='Total';
endcomp;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;errors:&lt;/P&gt;
&lt;P&gt;ERROR: A GROUP variable appears above or below other report items.&lt;BR /&gt;Name Usage&lt;BR /&gt;-------------------------------- --------&lt;BR /&gt;Region GROUP&lt;BR /&gt;Sales ANALYSIS&lt;BR /&gt;ERROR: There is a statistic but no ANALYSIS usage associated&lt;BR /&gt;with the column defined by the following elements.&lt;BR /&gt;Name Usage&lt;BR /&gt;-------------------------------- --------&lt;BR /&gt;sum STATISTIC&lt;BR /&gt;ERROR: There is a statistic but no ANALYSIS usage associated&lt;BR /&gt;with the column defined by the following elements.&lt;BR /&gt;Name Usage&lt;BR /&gt;-------------------------------- --------&lt;BR /&gt;pctsum STATISTIC&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2019 04:56:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-report-sum-count-PCT-count-PCT-sum/m-p/591777#M169585</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2019-09-26T04:56:08Z</dc:date>
    </item>
    <item>
      <title>Re: proc report: sum ,count,PCT count,PCT sum</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-report-sum-count-PCT-count-PCT-sum/m-p/591832#M169623</link>
      <description>&lt;P&gt;I think you should switch into PROC TABULATE for these summary statistics.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc report data=sashelp.shoes nowd;
column region sales,(n sum  pctn pctsum);
define region /group style(column)=header;
define sales/sum;
define n/ 'count' f=comma6.;
define sum/ 'sum_sales' f=dollar15.;
define pctn / 'percent from total counts' f=percent9.2;
define pctsum/ 'percent from total sum_sales' f=percent9.2;

rbreak after /summarize  style (summary)=Header;
compute after;
region='Total';
endcomp;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 26 Sep 2019 11:55:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-report-sum-count-PCT-count-PCT-sum/m-p/591832#M169623</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-09-26T11:55:49Z</dc:date>
    </item>
    <item>
      <title>Re: proc report: sum ,count,PCT count,PCT sum</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-report-sum-count-PCT-count-PCT-sum/m-p/591872#M169647</link>
      <description>&lt;P&gt;To control the labels as you are attempting you would need to use alias names for each column:&lt;/P&gt;
&lt;PRE&gt;proc report data=sashelp.shoes;
column region  sales=salesn sales sales=salespct sales=salespctsum;
define region /group style(column)=header;
define salesn/ N 'count' f=comma6.;
define sales/sum 'sum_sales' f=dollar15.;
define salespct/pctn  'percent from total counts' f=percent9.2;
define salespctsum/ pctsum'percent from total sum_sales' f=percent9.2;

rbreak after /summarize  style (summary)=Header;
compute after;
region='Total';
endcomp;
run;
&lt;/PRE&gt;
&lt;P&gt;There is an example in the Proc Report documentation for Using Aliases to Obtain Multiple Statistics for the Same Variable, which is what you are attempting.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think that you intended something like:&lt;/P&gt;
&lt;PRE&gt;column region sales&lt;FONT size="4"&gt;&lt;STRONG&gt;&lt;FONT color="#ff00ff"&gt;,&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;(n sum  pctn pctsum);
&lt;/PRE&gt;
&lt;P&gt;The comma after region was forcing the "statistics" into a different role as there was no way to determine which variable you requested sum, pctn and pctsum statics for.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but all of the statistics use the default format for sales, which really works poorly with percentage calculations.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2019 14:26:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-report-sum-count-PCT-count-PCT-sum/m-p/591872#M169647</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-09-26T14:26:57Z</dc:date>
    </item>
    <item>
      <title>Re: proc report: sum ,count,PCT count,PCT sum</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-report-sum-count-PCT-count-PCT-sum/m-p/591941#M169667</link>
      <description>&lt;P&gt;Thank you very much.&lt;/P&gt;
&lt;P&gt;As I understand you don't recommend using proc report for this request(calculate sum,N,PCT,PCTSUM).&lt;/P&gt;
&lt;P&gt;May you please send code with proc tabulate that calculate these statistics.&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 19:25:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-report-sum-count-PCT-count-PCT-sum/m-p/591941#M169667</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2020-01-23T19:25:27Z</dc:date>
    </item>
    <item>
      <title>Re: proc report: sum ,count,PCT count,PCT sum</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-report-sum-count-PCT-count-PCT-sum/m-p/591943#M169668</link>
      <description>&lt;P&gt;Thank you.&lt;/P&gt;
&lt;P&gt;I didn't understand....did you mean that we cannot use the way of writing&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;column region sales&lt;FONT size="4"&gt;&lt;STRONG&gt;&lt;FONT color="#ff00ff"&gt;,&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;(n sum  pctn pctsum);&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2019 18:16:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-report-sum-count-PCT-count-PCT-sum/m-p/591943#M169668</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2019-09-26T18:16:23Z</dc:date>
    </item>
    <item>
      <title>Re: proc report: sum ,count,PCT count,PCT sum</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-report-sum-count-PCT-count-PCT-sum/m-p/592011#M169696</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you.&lt;/P&gt;
&lt;P&gt;I didn't understand....did you mean that we cannot use the way of writing&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;column region sales&lt;FONT size="4"&gt;&lt;STRONG&gt;&lt;FONT color="#ff00ff"&gt;,&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;(n sum  pctn pctsum);&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You can use it that way. But run it against&amp;nbsp;the data set. The values for pctn and pctsum will look odd because of the formats assigned.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2019 20:14:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-report-sum-count-PCT-count-PCT-sum/m-p/592011#M169696</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-09-26T20:14:25Z</dc:date>
    </item>
    <item>
      <title>Re: proc report: sum ,count,PCT count,PCT sum</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-report-sum-count-PCT-count-PCT-sum/m-p/592031#M169705</link>
      <description>&lt;P&gt;Can you please show the code with "column region sales&lt;FONT size="4"&gt;&lt;STRONG&gt;&lt;FONT color="#ff00ff"&gt;,&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;(n sum pctn pctsum);"?&lt;/P&gt;
&lt;P&gt;I want to see if it works and also to see the difference in comparison to the code you provided before&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2019 21:04:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-report-sum-count-PCT-count-PCT-sum/m-p/592031#M169705</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2019-09-26T21:04:52Z</dc:date>
    </item>
    <item>
      <title>Re: proc report: sum ,count,PCT count,PCT sum</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-report-sum-count-PCT-count-PCT-sum/m-p/619644#M181985</link>
      <description>&lt;P&gt;I don't understand...In the required output should have 5 columns( region,No_Rows,PCT_Rows,Sales_SUM,PCT_sales_SUM).&lt;/P&gt;
&lt;P&gt;Why in the proc report code there are 6 Define statements if we need only 5 columns?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why are there 2 Define statements for sum of sales?&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token keyword"&gt;define&lt;/SPAN&gt; sales&lt;SPAN class="token operator"&gt;/&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;sum&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token keyword"&gt;define&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;sum&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;/&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;'sum_sales'&lt;/SPAN&gt; f&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;dollar15&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Jan 2020 19:26:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-report-sum-count-PCT-count-PCT-sum/m-p/619644#M181985</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2020-01-23T19:26:04Z</dc:date>
    </item>
    <item>
      <title>Re: proc report: sum ,count,PCT count,PCT sum</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-report-sum-count-PCT-count-PCT-sum/m-p/619979#M182112</link>
      <description>&lt;P&gt;Actually you could drop&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class="  language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token keyword"&gt;define&lt;/SPAN&gt; sales&lt;SPAN class="token operator"&gt;/&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;sum&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 25 Jan 2020 07:23:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-report-sum-count-PCT-count-PCT-sum/m-p/619979#M182112</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-01-25T07:23:03Z</dc:date>
    </item>
  </channel>
</rss>

