<?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: compute the percentages in proc report in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/compute-the-percentages-in-proc-report/m-p/439394#M20486</link>
    <description>&lt;P&gt;I have another question I just want to add the word total to the end&amp;nbsp;&lt;/P&gt;&lt;P&gt;can you show me how I can do it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;sorry about that but I'm really new to proc report&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Top 3 Sites with highest # issues&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;# Open Issues&lt;/TD&gt;&lt;TD&gt;percentages&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1350&lt;/TD&gt;&lt;TD&gt;7&lt;/TD&gt;&lt;TD&gt;35%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1601&lt;/TD&gt;&lt;TD&gt;7&lt;/TD&gt;&lt;TD&gt;35%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1450&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;30%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;total&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;TD&gt;100%&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
    <pubDate>Thu, 22 Feb 2018 18:31:16 GMT</pubDate>
    <dc:creator>mona4u</dc:creator>
    <dc:date>2018-02-22T18:31:16Z</dc:date>
    <item>
      <title>compute the percentages in proc report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/compute-the-percentages-in-proc-report/m-p/439338#M20477</link>
      <description>&lt;P&gt;I'm running proc report using this code and that's what I got. I'm not able to compute the right percentages.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please advise me how I can enhance my code&amp;nbsp; to get the aimed result&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc report data=QUERIES3;&lt;BR /&gt;column SITE_NUMBER numsites percentages;&lt;BR /&gt;define SITE_NUMBER/ "Top 3 Sites with highest # issues";&lt;BR /&gt;define numsites/ analysis sum "# Open Issues";&lt;BR /&gt;define percentages/ computed format=percent9.3;&lt;/P&gt;&lt;P&gt;COMPUTE percentages;&lt;BR /&gt;percentages=(numsites/numsites.sum);&lt;BR /&gt;endcomp;&lt;BR /&gt;rbreak after/ summarize ;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;Top 3 Sites with highest # issues&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;# Open Issues&lt;/TD&gt;&lt;TD&gt;percentages&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1350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TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1601&lt;/TD&gt;&lt;TD&gt;7&lt;/TD&gt;&lt;TD&gt;35%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1450&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;30%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;TD&gt;100%&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Thu, 22 Feb 2018 16:04:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/compute-the-percentages-in-proc-report/m-p/439338#M20477</guid>
      <dc:creator>mona4u</dc:creator>
      <dc:date>2018-02-22T16:04:12Z</dc:date>
    </item>
    <item>
      <title>Re: compute the percentages in proc report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/compute-the-percentages-in-proc-report/m-p/439340#M20478</link>
      <description>&lt;P&gt;PROC FREQ makes it simple.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=have;
     tables site_number;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 22 Feb 2018 16:07:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/compute-the-percentages-in-proc-report/m-p/439340#M20478</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-02-22T16:07:23Z</dc:date>
    </item>
    <item>
      <title>Re: compute the percentages in proc report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/compute-the-percentages-in-proc-report/m-p/439343#M20479</link>
      <description>&lt;P&gt;Hi: You didn't post all of your code (such as your ODS statements) or any data for people to test with. You refer to numsites correctly as numsites.sum in one place in your compute block, but not in the other.But without seeing your data, it's hard to decide what to recommend. &lt;BR /&gt;&lt;BR /&gt;Is SITE_NUMBER character? If so, it has a default usage of DISPLAY. If it is numeric, then it has a default usage of SUM.&lt;BR /&gt;&lt;BR /&gt; Here's an example using FAKE data of how you need to capture the grand total for NUMSITES into a temporary variable before you start writing report rows. Then you use that temporary variable to generate the calculated percentage. I will post a code example using fake data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;title; footnote;
data fakedata;
  infile datalines;
  input site $ numsites;
return;
datalines;
aaa 7
bbb 7
ccc 6
;
run;

proc report data=fakedata;
  column site numsites calcpct;
  define site / display;
  define numsites / sum;
  define calcpct / computed 'Percent' f=percent9.2;
  rbreak after / summarize;
  compute before;
    holdtot = numsites.sum;
  endcomp;
  compute calcpct;
    calcpct = numsites.sum / holdtot;
  endcomp;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;cynthia&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2018 16:33:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/compute-the-percentages-in-proc-report/m-p/439343#M20479</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2018-02-22T16:33:40Z</dc:date>
    </item>
    <item>
      <title>Re: compute the percentages in proc report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/compute-the-percentages-in-proc-report/m-p/439345#M20480</link>
      <description>&lt;P&gt;It wouldn't give me the result I want&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2018 16:21:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/compute-the-percentages-in-proc-report/m-p/439345#M20480</guid>
      <dc:creator>mona4u</dc:creator>
      <dc:date>2018-02-22T16:21:25Z</dc:date>
    </item>
    <item>
      <title>Re: compute the percentages in proc report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/compute-the-percentages-in-proc-report/m-p/439346#M20481</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/134228"&gt;@mona4u&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;It wouldn't give me the result I want&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I can't help you if that's all the information you are going to provide.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2018 16:22:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/compute-the-percentages-in-proc-report/m-p/439346#M20481</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-02-22T16:22:56Z</dc:date>
    </item>
    <item>
      <title>Re: compute the percentages in proc report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/compute-the-percentages-in-proc-report/m-p/439394#M20486</link>
      <description>&lt;P&gt;I have another question I just want to add the word total to the end&amp;nbsp;&lt;/P&gt;&lt;P&gt;can you show me how I can do it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;sorry about that but I'm really new to proc report&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Top 3 Sites with highest # issues&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;# Open Issues&lt;/TD&gt;&lt;TD&gt;percentages&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1350&lt;/TD&gt;&lt;TD&gt;7&lt;/TD&gt;&lt;TD&gt;35%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1601&lt;/TD&gt;&lt;TD&gt;7&lt;/TD&gt;&lt;TD&gt;35%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1450&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;30%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;total&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;TD&gt;100%&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Thu, 22 Feb 2018 18:31:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/compute-the-percentages-in-proc-report/m-p/439394#M20486</guid>
      <dc:creator>mona4u</dc:creator>
      <dc:date>2018-02-22T18:31:16Z</dc:date>
    </item>
    <item>
      <title>Re: compute the percentages in proc report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/compute-the-percentages-in-proc-report/m-p/439490#M20490</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; You need a COMPUTE AFTER block, the method that I show (a simple assignment statement) will only work if the LENGTH of SITE is $5 or bigger. The changes to the previous program are highlighted in yellow:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;cynthia&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" image-alt="compute_after_total.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/18766iEDCF80044845AB06/image-size/large?v=v2&amp;amp;px=999" role="button" title="compute_after_total.png" alt="compute_after_total.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2018 21:58:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/compute-the-percentages-in-proc-report/m-p/439490#M20490</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2018-02-22T21:58:20Z</dc:date>
    </item>
    <item>
      <title>Re: compute the percentages in proc report</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/compute-the-percentages-in-proc-report/m-p/439821#M20493</link>
      <description>&lt;P&gt;Thanks so much it's working&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Feb 2018 19:58:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/compute-the-percentages-in-proc-report/m-p/439821#M20493</guid>
      <dc:creator>mona4u</dc:creator>
      <dc:date>2018-02-23T19:58:46Z</dc:date>
    </item>
  </channel>
</rss>

