<?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: Summing across in proc sql in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Summing-across-in-proc-sql/m-p/168714#M43643</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The original data has Employee ID, quarterly donations made (Qtr1, Qtr2, Qtr3, Qtr4), and Recipients of the donations (I just changed those to peoples name to be more generic.&amp;nbsp; They can be the name of any 3 charities).&amp;nbsp; I want to find the avg donation, max donation, and the count (that is, how many quarters did each Employee donate).&amp;nbsp; Thanks for the info on the OR that I was trying to perform.&amp;nbsp; That was meant to act as a filter to just find data on certain charities.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 10 Feb 2014 13:24:58 GMT</pubDate>
    <dc:creator>mdbenson</dc:creator>
    <dc:date>2014-02-10T13:24:58Z</dc:date>
    <item>
      <title>Summing across in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Summing-across-in-proc-sql/m-p/168711#M43640</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm very new to SAS and I've written this code and it bombs out.&amp;nbsp; Could any of you experts show me there errors of my way?&amp;nbsp; I'm trying to get the average, max and count (some quarters are missing) for 4 quarters of data.&amp;nbsp; Also, in the WHERE statement at the bottom, I'm trying to subset where the Recipients were the 3 listed??&amp;nbsp; Can I use the ||&amp;nbsp; to mean OR?&amp;nbsp; I thought I read you could.&amp;nbsp; Any help would be great!&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; select Employee_ID 'Employee ID', &lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; (sum(Qtr1, Qtr2, Qtr3, Qtr4)/count(Qtr1, Qtr2, Qtr3, Qtr4)) as avg_don 'Average Donation',&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; max(Qtr1, Qtr2, Qtr3, Qtr4) as max_don 'Maximum Donation',&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp; count(Qtr1, Qtr2, Qtr3, Qtr4) as qtr_don 'Quarters Donated'&lt;/P&gt;&lt;P&gt;&amp;nbsp; from sqldata.employee_donations&lt;/P&gt;&lt;P&gt;&amp;nbsp; where (find(Recipients, "Bob" || "Kevin" || "Ashely", "i") &amp;gt; 0);&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Feb 2014 05:52:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Summing-across-in-proc-sql/m-p/168711#M43640</guid>
      <dc:creator>mdbenson</dc:creator>
      <dc:date>2014-02-10T05:52:38Z</dc:date>
    </item>
    <item>
      <title>Re: Summing across in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Summing-across-in-proc-sql/m-p/168712#M43641</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What dos your source data look like, and what is the desired result?&lt;/P&gt;&lt;P&gt;As for the OR operator, a single pipe is used in SAS. || means character concatenation of the two expressions surrounding it.&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/67227/HTML/default/viewer.htm#p00iah2thp63bmn1lt20esag14lh.htm" title="http://support.sas.com/documentation/cdl/en/lrcon/67227/HTML/default/viewer.htm#p00iah2thp63bmn1lt20esag14lh.htm"&gt;SAS(R) 9.4 Language Reference: Concepts, Second Edition&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Be sure that you don't confuse SQL aggregation functions (works over columns) and the corresponding SAS functions (works on a row level).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Feb 2014 10:23:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Summing-across-in-proc-sql/m-p/168712#M43641</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2014-02-10T10:23:58Z</dc:date>
    </item>
    <item>
      <title>Re: Summing across in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Summing-across-in-proc-sql/m-p/168713#M43642</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Asuming you want to calculate the statistics per employee I am missing the "group by &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt; Employee_ID&lt;/SPAN&gt;" statement.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Feb 2014 10:33:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Summing-across-in-proc-sql/m-p/168713#M43642</guid>
      <dc:creator>Patrick_Tan</dc:creator>
      <dc:date>2014-02-10T10:33:02Z</dc:date>
    </item>
    <item>
      <title>Re: Summing across in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Summing-across-in-proc-sql/m-p/168714#M43643</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The original data has Employee ID, quarterly donations made (Qtr1, Qtr2, Qtr3, Qtr4), and Recipients of the donations (I just changed those to peoples name to be more generic.&amp;nbsp; They can be the name of any 3 charities).&amp;nbsp; I want to find the avg donation, max donation, and the count (that is, how many quarters did each Employee donate).&amp;nbsp; Thanks for the info on the OR that I was trying to perform.&amp;nbsp; That was meant to act as a filter to just find data on certain charities.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Feb 2014 13:24:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Summing-across-in-proc-sql/m-p/168714#M43643</guid>
      <dc:creator>mdbenson</dc:creator>
      <dc:date>2014-02-10T13:24:58Z</dc:date>
    </item>
    <item>
      <title>Re: Summing across in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Summing-across-in-proc-sql/m-p/168715#M43644</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Patrick_Tan.&amp;nbsp; I'll add that.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Feb 2014 13:26:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Summing-across-in-proc-sql/m-p/168715#M43644</guid>
      <dc:creator>mdbenson</dc:creator>
      <dc:date>2014-02-10T13:26:30Z</dc:date>
    </item>
  </channel>
</rss>

