<?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: How to conditionally break and summarize in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-conditionally-break-and-summarize/m-p/66453#M18991</link>
    <description>This this small modification to the (LINE) section of the code supplied by Chris.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
options ls=64;&lt;BR /&gt;
proc report data=sashelp.class nowd list;&lt;BR /&gt;
  column SEX AGE WEIGHT ;&lt;BR /&gt;
  define SEX    / group;&lt;BR /&gt;
  define AGE    / group;&lt;BR /&gt;
  define WEIGHT / analysis sum;&lt;BR /&gt;
  compute after AGE ; &lt;BR /&gt;
    if AGE&amp;gt;13 then TOTAL + WEIGHT.sum;&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
  compute before SEX; &lt;BR /&gt;
    TOTAL=.;&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
  compute after SEX; &lt;BR /&gt;
    line = catx(' ','Sum for', sex,'age &amp;gt; 13:',total);&lt;BR /&gt;
    l = length(line);&lt;BR /&gt;
    if sex eq 'F' then l=0;&lt;BR /&gt;
    line @20 line $varying50.  l; &lt;BR /&gt;
    *line @ 20 ' Sum for ' SEX $1. ' age &amp;gt; 13: ' TOTAL 4.;&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]</description>
    <pubDate>Thu, 27 Aug 2009 20:09:11 GMT</pubDate>
    <dc:creator>data_null__</dc:creator>
    <dc:date>2009-08-27T20:09:11Z</dc:date>
    <item>
      <title>How to conditionally break and summarize</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-conditionally-break-and-summarize/m-p/66450#M18988</link>
      <description>In proc report, I need to display each year's spending for 4 years, but only summarize 3 years at year break level. How do I do that? &lt;BR /&gt;
&lt;BR /&gt;
Your help is appreciated!</description>
      <pubDate>Mon, 24 Aug 2009 02:36:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-conditionally-break-and-summarize/m-p/66450#M18988</guid>
      <dc:creator>odmhx</dc:creator>
      <dc:date>2009-08-24T02:36:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to conditionally break and summarize</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-conditionally-break-and-summarize/m-p/66451#M18989</link>
      <description>You can use this example to get you started:&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc report data=sashelp.class;&lt;BR /&gt;
  column SEX AGE WEIGHT ;&lt;BR /&gt;
  define SEX    / group;&lt;BR /&gt;
  define AGE    / group;&lt;BR /&gt;
  define WEIGHT / analysis sum;&lt;BR /&gt;
  compute after AGE ; &lt;BR /&gt;
    if AGE&amp;gt;13 then TOTAL + WEIGHT.sum;&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
  compute before SEX; &lt;BR /&gt;
    TOTAL=.;&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
  compute after SEX; &lt;BR /&gt;
    line @ 20 ' Sum for ' SEX $1. ' age &amp;gt; 13: ' TOTAL 4.;&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
run;</description>
      <pubDate>Wed, 26 Aug 2009 06:08:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-conditionally-break-and-summarize/m-p/66451#M18989</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2009-08-26T06:08:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to conditionally break and summarize</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-conditionally-break-and-summarize/m-p/66452#M18990</link>
      <description>Thank you for your code. However, what I was trying to do was not to calculate the sum of female, but only to calculate the sum of the male.. So the output would look like this:&lt;BR /&gt;
&lt;BR /&gt;
                       Listing of NUMBERS Data Set                          &lt;BR /&gt;
&lt;BR /&gt;
                            S                      &lt;BR /&gt;
                            e                      &lt;BR /&gt;
                            x        Age     Weight&lt;BR /&gt;
                            F         11       50.5&lt;BR /&gt;
                                      12      161.5&lt;BR /&gt;
                                      13        182&lt;BR /&gt;
                                      14      192.5&lt;BR /&gt;
                                      15      224.5&lt;BR /&gt;
 &lt;BR /&gt;
                            M         11         85&lt;BR /&gt;
                                      12      310.5&lt;BR /&gt;
                                      13         84&lt;BR /&gt;
                                      14        215&lt;BR /&gt;
                                      15        245&lt;BR /&gt;
                                      16        150&lt;BR /&gt;
                    Sum for M age &amp;gt; 13:  610</description>
      <pubDate>Thu, 27 Aug 2009 02:31:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-conditionally-break-and-summarize/m-p/66452#M18990</guid>
      <dc:creator>odmhx</dc:creator>
      <dc:date>2009-08-27T02:31:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to conditionally break and summarize</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-conditionally-break-and-summarize/m-p/66453#M18991</link>
      <description>This this small modification to the (LINE) section of the code supplied by Chris.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
options ls=64;&lt;BR /&gt;
proc report data=sashelp.class nowd list;&lt;BR /&gt;
  column SEX AGE WEIGHT ;&lt;BR /&gt;
  define SEX    / group;&lt;BR /&gt;
  define AGE    / group;&lt;BR /&gt;
  define WEIGHT / analysis sum;&lt;BR /&gt;
  compute after AGE ; &lt;BR /&gt;
    if AGE&amp;gt;13 then TOTAL + WEIGHT.sum;&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
  compute before SEX; &lt;BR /&gt;
    TOTAL=.;&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
  compute after SEX; &lt;BR /&gt;
    line = catx(' ','Sum for', sex,'age &amp;gt; 13:',total);&lt;BR /&gt;
    l = length(line);&lt;BR /&gt;
    if sex eq 'F' then l=0;&lt;BR /&gt;
    line @20 line $varying50.  l; &lt;BR /&gt;
    *line @ 20 ' Sum for ' SEX $1. ' age &amp;gt; 13: ' TOTAL 4.;&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Thu, 27 Aug 2009 20:09:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-conditionally-break-and-summarize/m-p/66453#M18991</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2009-08-27T20:09:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to conditionally break and summarize</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-conditionally-break-and-summarize/m-p/66454#M18992</link>
      <description>Thank you so much! It really solves my problem!</description>
      <pubDate>Thu, 27 Aug 2009 20:15:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-conditionally-break-and-summarize/m-p/66454#M18992</guid>
      <dc:creator>odmhx</dc:creator>
      <dc:date>2009-08-27T20:15:39Z</dc:date>
    </item>
  </channel>
</rss>

