<?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: count and sum positive and negative values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/count-and-sum-positive-and-negative-values/m-p/886933#M350456</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/265860"&gt;@BrahmanandaRao&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This forum is about SAS users supporting other SAS users.&lt;/P&gt;
&lt;P&gt;What's appreciated is if you demonstrate some own effort as else you might end-up with people no more providing answers to your questions.&lt;/P&gt;</description>
    <pubDate>Sat, 29 Jul 2023 01:31:39 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2023-07-29T01:31:39Z</dc:date>
    <item>
      <title>count and sum positive and negative values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/count-and-sum-positive-and-negative-values/m-p/886802#M350401</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ds;
input values;
datalines;
-9
-6
3
4
-7
-1
-6
7
6
;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;How to count and sum positive and negative values&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jul 2023 12:22:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/count-and-sum-positive-and-negative-values/m-p/886802#M350401</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2023-07-28T12:22:12Z</dc:date>
    </item>
    <item>
      <title>Re: count and sum positive and nagitive values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/count-and-sum-positive-and-negative-values/m-p/886803#M350402</link>
      <description>&lt;P&gt;I don't propose to provide code for you, but here's how I would think about it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;I'd run a DATA step, which reads the data one row at a time&lt;/LI&gt;
&lt;LI&gt;In the data step, I'd keep two running totals, one for the positive and the other for the negative
&lt;OL&gt;
&lt;LI&gt;This means I'd have to compare each incoming VALUES to zero and depending on the result, update the appropriate sum.&lt;/LI&gt;
&lt;LI&gt;It also means that the variable holding the running sums have to be retained over a sequence of rows - i.e. not reset to missing.&lt;/LI&gt;
&lt;/OL&gt;
&lt;/LI&gt;
&lt;LI&gt;And I'd have to detect when I'm processing the last row, so as to output the results.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can also run something like proc means twice, once on the subset of positive values, and once on the negative subset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Editted note:&amp;nbsp; Finally, and most importantly, you can show what you tried (i.e. show us your SAS log), and you'll no doubt get helpful answers.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jul 2023 12:34:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/count-and-sum-positive-and-negative-values/m-p/886803#M350402</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2023-07-28T12:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: count and sum positive and negative values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/count-and-sum-positive-and-negative-values/m-p/886933#M350456</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/265860"&gt;@BrahmanandaRao&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This forum is about SAS users supporting other SAS users.&lt;/P&gt;
&lt;P&gt;What's appreciated is if you demonstrate some own effort as else you might end-up with people no more providing answers to your questions.&lt;/P&gt;</description>
      <pubDate>Sat, 29 Jul 2023 01:31:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/count-and-sum-positive-and-negative-values/m-p/886933#M350456</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2023-07-29T01:31:39Z</dc:date>
    </item>
  </channel>
</rss>

