<?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: Sum a case statement in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Sum-a-case-statement/m-p/891708#M352248</link>
    <description>&lt;P&gt;Your close parenthesis is in the wrong spot.&amp;nbsp; Try:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;SUM (CASE WHEN CODE = 'X' THEN -1 ELSE 1 END) as COUNT&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 30 Aug 2023 14:20:40 GMT</pubDate>
    <dc:creator>Quentin</dc:creator>
    <dc:date>2023-08-30T14:20:40Z</dc:date>
    <item>
      <title>Sum a case statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sum-a-case-statement/m-p/891703#M352247</link>
      <description>&lt;P&gt;Hello, I'm using Proc SQL and have the following statement where I'm deriving a count field.&amp;nbsp; My problem is I am trying to sum up the data and have fields I'm grouping by.&amp;nbsp; Is it possible to SUM the case statement because I don't want each record splitting out on me and I have lots of other fields summing up?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;CASE WHEN CODE = 'X' THEN -1 ELSE 1 END as COUNT,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not working:&lt;/P&gt;
&lt;P&gt;SUM (CASE WHEN CODE = 'X' THEN -1 ELSE 1 END as COUNT),&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2023 13:57:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sum-a-case-statement/m-p/891703#M352247</guid>
      <dc:creator>Cheesiepoof05</dc:creator>
      <dc:date>2023-08-30T13:57:38Z</dc:date>
    </item>
    <item>
      <title>Re: Sum a case statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sum-a-case-statement/m-p/891708#M352248</link>
      <description>&lt;P&gt;Your close parenthesis is in the wrong spot.&amp;nbsp; Try:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;SUM (CASE WHEN CODE = 'X' THEN -1 ELSE 1 END) as COUNT&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Aug 2023 14:20:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sum-a-case-statement/m-p/891708#M352248</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-08-30T14:20:40Z</dc:date>
    </item>
    <item>
      <title>Re: Sum a case statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sum-a-case-statement/m-p/891727#M352249</link>
      <description>Thank you!</description>
      <pubDate>Wed, 30 Aug 2023 14:50:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sum-a-case-statement/m-p/891727#M352249</guid>
      <dc:creator>Cheesiepoof05</dc:creator>
      <dc:date>2023-08-30T14:50:49Z</dc:date>
    </item>
  </channel>
</rss>

