<?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: RBREAK SUMMARIZE not computing COMPUTED Variable in PROC REPORT in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/RBREAK-SUMMARIZE-not-computing-COMPUTED-Variable-in-PROC-REPORT/m-p/677063#M204194</link>
    <description>&lt;P&gt;I don't think you can reference columns to the right of the place you are doing the calculations.&lt;/P&gt;</description>
    <pubDate>Sun, 16 Aug 2020 13:26:56 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2020-08-16T13:26:56Z</dc:date>
    <item>
      <title>RBREAK SUMMARIZE not computing COMPUTED Variable in PROC REPORT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/RBREAK-SUMMARIZE-not-computing-COMPUTED-Variable-in-PROC-REPORT/m-p/676468#M203981</link>
      <description>&lt;P&gt;I am trying to create a table with PROC REPORT that includes a summary line using RBREAK. I expected this line would summarize the computed variables, but it is not. Please advise. (Note: my pct. format just add the percent sign to 0 and is percent8.1 otherwise.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc report data=all_t2a nowd split="*"
		style(report)=[frame=hsides rules=none]
		style(header)=[background=white color=&amp;amp;rgreen. borderbottomcolor=black]
		style(lines)=[background=white];
	column sport_name tl2,(tot pct) ('Total' all all_pct);
	define sport_name / group '' center order=data format=$sport_cap. style(column)=[cellwidth=2in just=l] style(header)=[just=l];
	define tl2 / across '' order=data format=$tl_form.;
	define tot / analysis SUM 'n' format=comma8.0 style(column)=[cellwidth=0.75in just=c];
	define pct / computed "%" format=pct.;
   	define all / computed "n" format=comma8.0;
	define all_pct / computed '%' f=pct.;
	
	/* Sum total number of responses to question */
   	compute before sport_name;
      	den = _c2_ + _c4_ + _c6_;
   	endcomp;

   	/* Calculate percentage */
   	compute pct;
     	 _c3_ = _c2_ / den;
      	_c5_ = _c4_ / den;
	  	_c7_ = _c6_ / den;
   	endcomp;

   	compute all;
      	all = _c2_ + _c4_ + _c6_;
   	endcomp;

   	compute all_pct;
		all_pct = all / all;
	endcomp;

	rbreak before /summarize style(summary)={font_weight=bold};
	compute sport_name;
    	if _break_ = '_RBREAK_' then sport_name = 'Overall';
	endcomp;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="plot.png" style="width: 735px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/48193iCDDE495C46CF34A3/image-size/large?v=v2&amp;amp;px=999" role="button" title="plot.png" alt="plot.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Aug 2020 13:01:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/RBREAK-SUMMARIZE-not-computing-COMPUTED-Variable-in-PROC-REPORT/m-p/676468#M203981</guid>
      <dc:creator>tburus</dc:creator>
      <dc:date>2020-08-13T13:01:48Z</dc:date>
    </item>
    <item>
      <title>Re: RBREAK SUMMARIZE not computing COMPUTED Variable in PROC REPORT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/RBREAK-SUMMARIZE-not-computing-COMPUTED-Variable-in-PROC-REPORT/m-p/677051#M204189</link>
      <description>&lt;P&gt;I think the problem is with having the denominator in a separate compute statement, and there is no need to, AFAIK.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So this may work:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc report data=all_t2a nowd split="*"
		style(report)=[frame=hsides rules=none]
		style(header)=[background=white color=&amp;amp;rgreen. borderbottomcolor=black]
		style(lines)=[background=white];
	column sport_name tl2,(tot pct) ('Total' all all_pct);
	define sport_name / group '' center order=data format=$sport_cap. style(column)=[cellwidth=2in just=l] style(header)=[just=l];
	define tl2 / across '' order=data format=$tl_form.;
	define tot / analysis SUM 'n' format=comma8.0 style(column)=[cellwidth=0.75in just=c];
	define pct / computed "%" format=pct.;
   	define all / computed "n" format=comma8.0;
	define all_pct / computed '%' f=pct.;
	
    /* Calculate percentage */
   	compute pct;
	    /* Sum total number of responses to question */
      	den = _c2_ + _c4_ + _c6_;
     	 _c3_ = _c2_ / den;
      	_c5_ = _c4_ / den;
	  	_c7_ = _c6_ / den;
   	endcomp;

   	compute all;
      	all = _c2_ + _c4_ + _c6_;
   	endcomp;

   	compute all_pct;
		all_pct = all / all;
	endcomp;

	rbreak before /summarize style(summary)={font_weight=bold};
	compute sport_name;
    	if _break_ = '_RBREAK_' then sport_name = 'Overall';
	endcomp;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 16 Aug 2020 10:48:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/RBREAK-SUMMARIZE-not-computing-COMPUTED-Variable-in-PROC-REPORT/m-p/677051#M204189</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2020-08-16T10:48:30Z</dc:date>
    </item>
    <item>
      <title>Re: RBREAK SUMMARIZE not computing COMPUTED Variable in PROC REPORT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/RBREAK-SUMMARIZE-not-computing-COMPUTED-Variable-in-PROC-REPORT/m-p/677063#M204194</link>
      <description>&lt;P&gt;I don't think you can reference columns to the right of the place you are doing the calculations.&lt;/P&gt;</description>
      <pubDate>Sun, 16 Aug 2020 13:26:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/RBREAK-SUMMARIZE-not-computing-COMPUTED-Variable-in-PROC-REPORT/m-p/677063#M204194</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-08-16T13:26:56Z</dc:date>
    </item>
    <item>
      <title>Re: RBREAK SUMMARIZE not computing COMPUTED Variable in PROC REPORT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/RBREAK-SUMMARIZE-not-computing-COMPUTED-Variable-in-PROC-REPORT/m-p/677092#M204213</link>
      <description>&lt;P&gt;Have you tried?&lt;/P&gt;</description>
      <pubDate>Sun, 16 Aug 2020 17:50:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/RBREAK-SUMMARIZE-not-computing-COMPUTED-Variable-in-PROC-REPORT/m-p/677092#M204213</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2020-08-16T17:50:02Z</dc:date>
    </item>
  </channel>
</rss>

