<?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 and compute for sub-total headings in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-report-and-compute-for-sub-total-headings/m-p/126862#M25852</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; Basically you can do what you want 1 of 2 ways. (BTW, this "disconnect" will also happen if you have a character variable that has a really small length, too).&lt;/P&gt;&lt;P&gt;1) you create a character variable that's big enough for your subtotal string using a DATA step before PROC REPORT&lt;/P&gt;&lt;P&gt;2) you create a character variable that's big enough for your subtotal string using COMPUTED items in PROC REPORT&lt;/P&gt;&lt;P&gt;3) sometimes, you can use PRETEXT= with ODS, but if you are using LISTING, this method won't work for you&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; So the code below only shows #1 and #2. I generally stick with those 2 methods anyway, they are easier to explain to beginners. I didn't really understand your code -- why you are using AGE for ORDER and then also using it for SUM -- didn't make sense and the break didn't look reasonable. So I just created a simplified example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cynthia&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;data class;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; length show_age $40;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; set sashelp.class;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; show_age = put(age,2.0);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;run;&lt;/STRONG&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;ods html file='c:\temp\subtotal.html';&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;PROC REPORT DATA=CLASS&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nowd NOCENTER;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;title '1) use temp dataset with new character variable';&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;COLUMN&amp;nbsp; AGE show_age SEX NAME&amp;nbsp; HEIGHT WEIGHT;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;DEFINE AGE / ORDER FORMAT= BEST9. /* NOPRINT */;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;define show_age / order 'Age' right &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; style(column)={just=r};&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;DEFINE SEX / ORDER FORMAT= $1. ;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;DEFINE NAME / ORDER FORMAT= $8. ;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;DEFINE HEIGHT / SUM FORMAT= 8.2 ;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;DEFINE WEIGHT / SUM FORMAT= 8.2 ;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;BREAK AFTER AGE / SUMMARIZE;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;compute show_age;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; if upcase(_break_)='AGE' then do;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; brkline = 'Sum of Age '||trim(put(age,2.0));&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; show_age = brkline;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; end;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;endcomp;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;compute after age;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; line ' ';&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;endcomp;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;RUN;&lt;/STRONG&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;PROC REPORT DATA=SASHELP.CLASS&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nowd NOCENTER;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;title '2) use sashelp.class and compute new item in proc report';&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;COLUMN&amp;nbsp; AGE display_age SEX NAME&amp;nbsp; HEIGHT WEIGHT;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;DEFINE AGE / ORDER FORMAT= BEST9. /* NOPRINT */;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;define display_age / computed 'Age' right &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; style(column)={just=r};&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;DEFINE SEX / ORDER FORMAT= $1. ;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;DEFINE NAME / ORDER FORMAT= $8. ;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;DEFINE HEIGHT / SUM FORMAT= 8.2 ;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;DEFINE WEIGHT / SUM FORMAT= 8.2 ;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;BREAK AFTER AGE / SUMMARIZE;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;compute before age;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; hold = age;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;endcomp;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;compute display_age / character length=40;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; if age ne . then display_age = put(age,2.0);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; else display_age = ' ';&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; if upcase(_break_) = 'AGE' then do;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; brkline = 'Sum of Age '||trim(put(hold,2.0));&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; display_age = brkline;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; end;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;endcomp;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;compute after age;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; line ' ';&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;endcomp;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;RUN;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;ods html close;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 17 Jan 2013 15:34:14 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2013-01-17T15:34:14Z</dc:date>
    <item>
      <title>Proc report and compute for sub-total headings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-report-and-compute-for-sub-total-headings/m-p/126859#M25849</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;assuming I have a proc report that groups by CarType in Order to create nice&lt;BR /&gt;sub-totals by car type. I also need to CarType for which the sub-total&lt;BR /&gt;is created in a kind of "heading" for the sub-total.&lt;/P&gt;&lt;P&gt;Like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CarType&amp;nbsp; Value&lt;BR /&gt;A&amp;nbsp; 45 &lt;BR /&gt;A&amp;nbsp; 2&lt;BR /&gt;A&amp;nbsp; 3&lt;BR /&gt;Total for A 50&lt;/P&gt;&lt;P&gt;CarType&amp;nbsp; Value&lt;BR /&gt;B&amp;nbsp; 45 &lt;BR /&gt;B&amp;nbsp; 2&lt;BR /&gt;Total for B 47&lt;BR /&gt;Grand Total 97&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The "Total for.." how do I do that in a compute statement?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Jan 2013 12:22:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-report-and-compute-for-sub-total-headings/m-p/126859#M25849</guid>
      <dc:creator>metalray</dc:creator>
      <dc:date>2013-01-16T12:22:53Z</dc:date>
    </item>
    <item>
      <title>Re: Proc report and compute for sub-total headings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-report-and-compute-for-sub-total-headings/m-p/126860#M25850</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; What PROC REPORT code have you tried already? I am in class this afternoon and not in a position to test code, but if you were using REGION as your BREAK variable, then your COMPUTE block would be something like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cynthia&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;... more code ...&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;break after region/ summarize;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;rbreak after /summarize;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;compute after region;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; brkline = 'Total for '||trim(region);&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; region=brkline;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;endcomp;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;compute after;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; region = 'Grand Total';&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;endcomp;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Jan 2013 17:56:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-report-and-compute-for-sub-total-headings/m-p/126860#M25850</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2013-01-16T17:56:55Z</dc:date>
    </item>
    <item>
      <title>Re: Proc report and compute for sub-total headings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-report-and-compute-for-sub-total-headings/m-p/126861#M25851</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Cynthia,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks, that is like what I was looking for.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;There is just one problem. Lets look at this example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC REPORT DATA=SASHELP.CLASS LS=80 PS=44 SPLIT="/" NOCENTER BOX;&lt;BR /&gt;COLUMN SEX AGE NAME AGE=_A1 HEIGHT WEIGHT;&lt;BR /&gt;DEFINE SEX / ORDER FORMAT= $1. ;&lt;BR /&gt;DEFINE AGE / ORDER FORMAT= BEST9. ;&lt;BR /&gt;DEFINE NAME / ORDER FORMAT= $8. ;&lt;BR /&gt;DEFINE _A1 / SUM FORMAT= BEST9. ;&lt;BR /&gt;DEFINE HEIGHT / SUM FORMAT= 8.2 ;&lt;BR /&gt;DEFINE WEIGHT / SUM FORMAT= 8.2 ;&lt;BR /&gt;BREAK AFTER SEX / SUMMARIZE;&lt;BR /&gt;BREAK AFTER AGE / SUMMARIZE;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;compute after AGE;&lt;BR /&gt;brkline = 'Sum of Age '||trim(AGE);&lt;BR /&gt;AGE=brkline;&lt;BR /&gt;endcomp; &lt;/P&gt;&lt;P&gt;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;If I now want to create a sub-heading that says "Sum of Age ...." &lt;BR /&gt;for the sub-totals, SAS then tries to write "Sum of Age ...."&lt;BR /&gt;into the AGE column, which does not work, because its a number.&lt;BR /&gt;I need this "Sum of Age ...." to the very left, I dont mind adding a new line for that. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Jan 2013 12:48:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-report-and-compute-for-sub-total-headings/m-p/126861#M25851</guid>
      <dc:creator>metalray</dc:creator>
      <dc:date>2013-01-17T12:48:39Z</dc:date>
    </item>
    <item>
      <title>Re: Proc report and compute for sub-total headings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-report-and-compute-for-sub-total-headings/m-p/126862#M25852</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; Basically you can do what you want 1 of 2 ways. (BTW, this "disconnect" will also happen if you have a character variable that has a really small length, too).&lt;/P&gt;&lt;P&gt;1) you create a character variable that's big enough for your subtotal string using a DATA step before PROC REPORT&lt;/P&gt;&lt;P&gt;2) you create a character variable that's big enough for your subtotal string using COMPUTED items in PROC REPORT&lt;/P&gt;&lt;P&gt;3) sometimes, you can use PRETEXT= with ODS, but if you are using LISTING, this method won't work for you&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; So the code below only shows #1 and #2. I generally stick with those 2 methods anyway, they are easier to explain to beginners. I didn't really understand your code -- why you are using AGE for ORDER and then also using it for SUM -- didn't make sense and the break didn't look reasonable. So I just created a simplified example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cynthia&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;data class;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; length show_age $40;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; set sashelp.class;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; show_age = put(age,2.0);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;run;&lt;/STRONG&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;ods html file='c:\temp\subtotal.html';&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;PROC REPORT DATA=CLASS&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nowd NOCENTER;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;title '1) use temp dataset with new character variable';&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;COLUMN&amp;nbsp; AGE show_age SEX NAME&amp;nbsp; HEIGHT WEIGHT;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;DEFINE AGE / ORDER FORMAT= BEST9. /* NOPRINT */;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;define show_age / order 'Age' right &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; style(column)={just=r};&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;DEFINE SEX / ORDER FORMAT= $1. ;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;DEFINE NAME / ORDER FORMAT= $8. ;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;DEFINE HEIGHT / SUM FORMAT= 8.2 ;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;DEFINE WEIGHT / SUM FORMAT= 8.2 ;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;BREAK AFTER AGE / SUMMARIZE;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;compute show_age;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; if upcase(_break_)='AGE' then do;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; brkline = 'Sum of Age '||trim(put(age,2.0));&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; show_age = brkline;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; end;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;endcomp;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;compute after age;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; line ' ';&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;endcomp;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;RUN;&lt;/STRONG&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;PROC REPORT DATA=SASHELP.CLASS&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nowd NOCENTER;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;title '2) use sashelp.class and compute new item in proc report';&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;COLUMN&amp;nbsp; AGE display_age SEX NAME&amp;nbsp; HEIGHT WEIGHT;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;DEFINE AGE / ORDER FORMAT= BEST9. /* NOPRINT */;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;define display_age / computed 'Age' right &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; style(column)={just=r};&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;DEFINE SEX / ORDER FORMAT= $1. ;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;DEFINE NAME / ORDER FORMAT= $8. ;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;DEFINE HEIGHT / SUM FORMAT= 8.2 ;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;DEFINE WEIGHT / SUM FORMAT= 8.2 ;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;BREAK AFTER AGE / SUMMARIZE;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;compute before age;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; hold = age;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;endcomp;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;compute display_age / character length=40;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; if age ne . then display_age = put(age,2.0);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; else display_age = ' ';&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; if upcase(_break_) = 'AGE' then do;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; brkline = 'Sum of Age '||trim(put(hold,2.0));&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; display_age = brkline;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; end;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;endcomp;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;compute after age;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; line ' ';&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;endcomp;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;RUN;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;ods html close;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Jan 2013 15:34:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-report-and-compute-for-sub-total-headings/m-p/126862#M25852</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2013-01-17T15:34:14Z</dc:date>
    </item>
    <item>
      <title>Re: Proc report and compute for sub-total headings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-report-and-compute-for-sub-total-headings/m-p/126863#M25853</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Cynthia!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jan 2013 16:38:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-report-and-compute-for-sub-total-headings/m-p/126863#M25853</guid>
      <dc:creator>metalray</dc:creator>
      <dc:date>2013-01-21T16:38:56Z</dc:date>
    </item>
  </channel>
</rss>

