<?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: Multiple Compute Before in Proc Report in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Multiple-Compute-Before-in-Proc-Report/m-p/424273#M27335</link>
    <description>&lt;P&gt;Some issues:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;There is a note in the log about missing values causing trouble. &lt;/LI&gt;
&lt;LI&gt;display + analysis does not make sense.&lt;/LI&gt;
&lt;LI&gt;The format you are using to display variables A-F does not match the format of your requested output.&lt;/LI&gt;
&lt;LI&gt;You are using SUM statistic for variables A-F.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Solution:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Add keyword "missing" to the proc report-statement.&lt;/LI&gt;
&lt;LI&gt;Change statistic from "sum" to "pctsum" and format to "percent8.2"&lt;/LI&gt;
&lt;LI&gt;remove the computed variables.&lt;/LI&gt;
&lt;/UL&gt;</description>
    <pubDate>Tue, 02 Jan 2018 07:18:09 GMT</pubDate>
    <dc:creator>andreas_lds</dc:creator>
    <dc:date>2018-01-02T07:18:09Z</dc:date>
    <item>
      <title>Multiple Compute Before in Proc Report</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Multiple-Compute-Before-in-Proc-Report/m-p/424234#M27334</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to calculate the percentage on multiple columns in a Proc Report. I'm using Compute Before however after the first compute I get the following error - &lt;FONT color="#ff0000"&gt;ERROR: There are multiple COMPUTE statements for RBREAK BEFORE&amp;nbsp; .&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;My test data is &lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
	Input Centre $ A B C D E F Total_Calls;
	Datalines;
ADL 3 279 646 . 276 120  1324
BAL . 1298 1775 . 200 859 4152
Bay . 928 . 4 . 12 944 
Ben 546 . . 195 1 60 802
Bri . 342 736 . 69 429 1576
Bun . 966 2257 . 214 1199 4636
Cai 163 . 2 . . 631 796
Can 16 . 137 . . 91 244
Cen 450 2 774 400 . 396 2022
Cof 2465 1 2206 876 . 311 5859
;
Run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;and the proc report code is&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Proc Report Data=Test;
	Column CENTRE A B C D E F Total_Calls APct BPct;
	Define Centre / DISPLAY;
	Define A / DISPLAY 'A' Analysis SUM f=comma9. Style(Column)=[cellwidth=1in];
	Define B / DISPLAY 'B' Analysis SUM f=comma9. Style(Column)=[cellwidth=1in];
	Define C / DISPLAY 'C' Analysis SUM f=comma9. Style(Column)=[cellwidth=1in];
	Define D / DISPLAY 'D' Analysis SUM f=comma9. Style(Column)=[cellwidth=1in];
	Define E / DISPLAY 'E' Analysis SUM f=comma9. Style(Column)=[cellwidth=1in];
	Define F / DISPLAY 'F' Analysis SUM f=comma9. Style(Column)=[cellwidth=1in];
	Define Total_calls / Display 'Total' Analysis SUM f=comma9. Style(Column)=[cellwidth=1in];



	Compute Before;
				A_Total = A.SUM;
			Endcomp;

			Define APct / COMPUTED 'A Percent' f=Percent9.0 STYLE( column )={TAGATTR='format:0.00'};

			Compute APct;
				APct = A.SUM / A_Total;
			ENDCOMP;

Compute before;
				B_Total = B.SUM;
			Endcomp;

			Define BPct / COMPUTED 'B Percent' f=Percent9.0 STYLE( column )={TAGATTR='format:0.00'};

			Compute BPct;
				BPct = B.SUM / B_Total;
			ENDCOMP;



RBREAK AFTER / SUmmarize;

Run;

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;If I use the Compute after in the second and subsequent Compute statements it doesn't calculate the percentage.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;The output I want would look like &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Output4.GIF" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/17576iE4C3A367A34FC1EE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Output4.GIF" alt="Output4.GIF" /&gt;&lt;/span&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Is Proc Report the best proc to use? ANy help appreciated.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Cheers&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Dean&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jan 2018 00:50:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Multiple-Compute-Before-in-Proc-Report/m-p/424234#M27334</guid>
      <dc:creator>DME790</dc:creator>
      <dc:date>2018-01-02T00:50:31Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple Compute Before in Proc Report</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Multiple-Compute-Before-in-Proc-Report/m-p/424273#M27335</link>
      <description>&lt;P&gt;Some issues:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;There is a note in the log about missing values causing trouble. &lt;/LI&gt;
&lt;LI&gt;display + analysis does not make sense.&lt;/LI&gt;
&lt;LI&gt;The format you are using to display variables A-F does not match the format of your requested output.&lt;/LI&gt;
&lt;LI&gt;You are using SUM statistic for variables A-F.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Solution:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Add keyword "missing" to the proc report-statement.&lt;/LI&gt;
&lt;LI&gt;Change statistic from "sum" to "pctsum" and format to "percent8.2"&lt;/LI&gt;
&lt;LI&gt;remove the computed variables.&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Tue, 02 Jan 2018 07:18:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Multiple-Compute-Before-in-Proc-Report/m-p/424273#M27335</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2018-01-02T07:18:09Z</dc:date>
    </item>
  </channel>
</rss>

