<?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 sums/subtotals in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/proc-report-sums-subtotals/m-p/110968#M30768</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hi:&lt;/P&gt;&lt;P&gt;&amp;nbsp; If you are using PROC REPORT and the BREAK statement (or the RBREAK statement), you can control the location of the summary line(s) using:&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;BREAK &lt;SPAN style="color: #ff00ff;"&gt;BEFORE&lt;/SPAN&gt; &lt;EM&gt;&amp;lt;brkvar&amp;gt;&lt;/EM&gt; / summarize;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;OR&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;RBREAK &lt;SPAN style="color: #ff00ff;"&gt;BEFORE&lt;/SPAN&gt; / summarize;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(what you usually see in PROC REPORT is BREAK AFTER &amp;lt;brkvar&amp;gt; and RBREAK AFTER). The BREAK statement gives you a subtotal for each of a group or order variable and the RBREAK statement gives you a single "grand total". So, if you want the grand total at the top of the report, you would use RBREAK BEFORE, as shown. If you want a subtotal at the top of each GROUP, then you would use BREAK BEFORE brkvar, as shown above.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cynthia&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 18 Jul 2012 20:13:22 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2012-07-18T20:13:22Z</dc:date>
    <item>
      <title>proc report sums/subtotals</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-report-sums-subtotals/m-p/110967#M30767</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi.&amp;nbsp; I'm creating a report with subtotals and exporting them to excel via ods.&amp;nbsp; Is there a way to put the subtotal at the top of the report instead of the bottom?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jul 2012 19:49:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-report-sums-subtotals/m-p/110967#M30767</guid>
      <dc:creator>alenderts</dc:creator>
      <dc:date>2012-07-18T19:49:30Z</dc:date>
    </item>
    <item>
      <title>Re: proc report sums/subtotals</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-report-sums-subtotals/m-p/110968#M30768</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hi:&lt;/P&gt;&lt;P&gt;&amp;nbsp; If you are using PROC REPORT and the BREAK statement (or the RBREAK statement), you can control the location of the summary line(s) using:&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;BREAK &lt;SPAN style="color: #ff00ff;"&gt;BEFORE&lt;/SPAN&gt; &lt;EM&gt;&amp;lt;brkvar&amp;gt;&lt;/EM&gt; / summarize;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;OR&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;RBREAK &lt;SPAN style="color: #ff00ff;"&gt;BEFORE&lt;/SPAN&gt; / summarize;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(what you usually see in PROC REPORT is BREAK AFTER &amp;lt;brkvar&amp;gt; and RBREAK AFTER). The BREAK statement gives you a subtotal for each of a group or order variable and the RBREAK statement gives you a single "grand total". So, if you want the grand total at the top of the report, you would use RBREAK BEFORE, as shown. If you want a subtotal at the top of each GROUP, then you would use BREAK BEFORE brkvar, as shown above.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cynthia&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jul 2012 20:13:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-report-sums-subtotals/m-p/110968#M30768</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2012-07-18T20:13:22Z</dc:date>
    </item>
    <item>
      <title>Re: proc report sums/subtotals</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-report-sums-subtotals/m-p/110969#M30769</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sure. Don't forget LINE statement ,also can do this way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jul 2012 02:51:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-report-sums-subtotals/m-p/110969#M30769</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-07-19T02:51:26Z</dc:date>
    </item>
    <item>
      <title>Re: proc report sums/subtotals</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-report-sums-subtotals/m-p/110970#M30770</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;nbsp; True, they could use the LINE statement to write out text before or after a group of rows. If the OP had been interested in the LISTING destination for output, this might have worked to get the subtotal number aligned with the numbers in the column being summarized.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; However, techniques like @5 or @56 do NOT work for regular ODS destinations.&amp;nbsp; And since the OP said the desired destination was to open the file with Excel (which implies ODS CSV, ODS HTML or ODS TAGSETS.EXCELXP or ODS MSOFFICE2K), it seemed more likely that BREAK processing with BREAK or RBREAK statements would end up with the subtotal number being displayed in the correct table column, once the output was opened in Excel.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cynthia&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jul 2012 03:13:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-report-sums-subtotals/m-p/110970#M30770</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2012-07-19T03:13:37Z</dc:date>
    </item>
    <item>
      <title>Re: proc report sums/subtotals</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-report-sums-subtotals/m-p/110971#M30771</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If I use proc print, I can get the subtotal row to contain the subtotal formula once it's in excel. If I use proc report, I can get a summary row at the top, but I'd like to have it contain the subtotal formula in case numbers are updated in excel.&amp;nbsp; I have a lot of excel files to create, so I'd like to have the subtotal formula inserted automatically.&amp;nbsp; Are there any options to have the formula and have it on top?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thanks!&lt;/P&gt;&lt;P&gt;Angie &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jul 2012 15:11:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-report-sums-subtotals/m-p/110971#M30771</guid>
      <dc:creator>alenderts</dc:creator>
      <dc:date>2012-07-19T15:11:26Z</dc:date>
    </item>
    <item>
      <title>Re: proc report sums/subtotals</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-report-sums-subtotals/m-p/110972#M30772</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;&amp;nbsp; How are you "using ods" to get your results into Excel: ODS HTML, ODS MSOFFICE2K, ODS MSOFFICE2K_X or ODS TAGSETS.EXCELXP?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; I believe that if you use PROC PRINT and TAGSETS.EXCELXP, then the AUTO_SUBTOTALS='yes' suboption is what inserts a formula into the subtotal cell. I do not think that will work for PROC REPORT -- the internal documentation is fairly clear that it will only work with PROC PRINT and only under certain circumstances:&lt;/P&gt;&lt;P&gt;(from the log)&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;Auto_SubTotals:&amp;nbsp;&amp;nbsp; Default Value 'No'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Values: yes, no, on, off.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If yes, this option causes a subtotal formula to be placed in the&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; subtotal cells on the last table row of the &lt;SPAN style="text-decoration: underline;"&gt;&lt;SPAN style="color: #ff00ff; text-decoration: underline;"&gt;Print Procedure's&lt;/SPAN&gt;&lt;/SPAN&gt; tables.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WARNING: This does not work with Sum By.&amp;nbsp; It only works if the&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; totals only happen once per table.&amp;nbsp; It also does not work if the by value&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and the id value match.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; You might need to work with Tech Support to see if there is a way to insert the formula into the cell if you are using PROC REPORT and BREAK BEFORE. The issue that I see is that although TAGSETS.EXCELXP will allow you to insert a formula into a cell, you need to know the cell range in order to get the formula correct. When the subtotal is at the bottom of the group, the number of cells in the group is known (which is probably how the suboption works -- it must have an internal counter). When the subtotal is at the top of the group, the number of cells is not known.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; If you are NOT using TAGSETS.EXCELXP, then I'm not sure how you are getting a formula in the cell automatically with PROC PRINT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cynthia&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jul 2012 16:45:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-report-sums-subtotals/m-p/110972#M30772</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2012-07-19T16:45:58Z</dc:date>
    </item>
  </channel>
</rss>

