<?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: Conditional SUM for rows in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Conditional-SUM-for-rows/m-p/352847#M23289</link>
    <description>&lt;P&gt;&lt;STRONG&gt;Post test data in the form of a datastep!&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc sql;
  create table WANT as
  select  YEAR,
          ORIG,
          DEST,
          sum(FLOW) as FLOW
  from    HAVE
  group by YEAR,ORIG,DEST;
quit;&lt;/PRE&gt;
&lt;P&gt;As &amp;nbsp;a guess.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 24 Apr 2017 13:42:49 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2017-04-24T13:42:49Z</dc:date>
    <item>
      <title>Conditional SUM for rows</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Conditional-SUM-for-rows/m-p/352845#M23288</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I have a dataset that looks like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="256"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="64"&gt;year&lt;/TD&gt;
&lt;TD width="64"&gt;orig&lt;/TD&gt;
&lt;TD width="64"&gt;dest&lt;/TD&gt;
&lt;TD width="64"&gt;flow&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1990&lt;/TD&gt;
&lt;TD&gt;AT&lt;/TD&gt;
&lt;TD&gt;BE&lt;/TD&gt;
&lt;TD&gt;456&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1990&lt;/TD&gt;
&lt;TD&gt;AT&lt;/TD&gt;
&lt;TD&gt;DE&lt;/TD&gt;
&lt;TD&gt;356&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1990&lt;/TD&gt;
&lt;TD&gt;AT&lt;/TD&gt;
&lt;TD&gt;DE&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;21&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1990&lt;/TD&gt;
&lt;TD&gt;BE&lt;/TD&gt;
&lt;TD&gt;DE&lt;/TD&gt;
&lt;TD&gt;235&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to sum the column "flow" when year, orig and dest have the same value. For instance, in that example, the dataset should become:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 192pt;" border="0" cellpadding="0" cellspacing="0" width="256"&gt;&lt;COLGROUP&gt;&lt;COL style="width: 48pt;" span="4" width="64" /&gt; &lt;/COLGROUP&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD style="height: 15.0pt; width: 48pt;" height="20" width="64"&gt;year&lt;/TD&gt;
&lt;TD style="width: 48pt;" width="64"&gt;orig&lt;/TD&gt;
&lt;TD style="width: 48pt;" width="64"&gt;dest&lt;/TD&gt;
&lt;TD style="width: 48pt;" width="64"&gt;flow&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD style="height: 15.0pt;" align="right" height="20"&gt;1990&lt;/TD&gt;
&lt;TD&gt;AT&lt;/TD&gt;
&lt;TD&gt;BE&lt;/TD&gt;
&lt;TD align="right"&gt;456&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD style="height: 15.0pt;" align="right" height="20"&gt;1990&lt;/TD&gt;
&lt;TD&gt;AT&lt;/TD&gt;
&lt;TD&gt;DE&lt;/TD&gt;
&lt;TD align="right"&gt;377&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD style="height: 15.0pt;" align="right" height="20"&gt;1990&lt;/TD&gt;
&lt;TD&gt;BE&lt;/TD&gt;
&lt;TD&gt;DE&lt;/TD&gt;
&lt;TD align="right"&gt;235&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a simple way to do this?&lt;/P&gt;</description>
      <pubDate>Mon, 24 Apr 2017 13:40:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Conditional-SUM-for-rows/m-p/352845#M23288</guid>
      <dc:creator>Demographer</dc:creator>
      <dc:date>2017-04-24T13:40:09Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional SUM for rows</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Conditional-SUM-for-rows/m-p/352847#M23289</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Post test data in the form of a datastep!&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc sql;
  create table WANT as
  select  YEAR,
          ORIG,
          DEST,
          sum(FLOW) as FLOW
  from    HAVE
  group by YEAR,ORIG,DEST;
quit;&lt;/PRE&gt;
&lt;P&gt;As &amp;nbsp;a guess.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Apr 2017 13:42:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Conditional-SUM-for-rows/m-p/352847#M23289</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-04-24T13:42:49Z</dc:date>
    </item>
  </channel>
</rss>

