<?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 positive record by id cumulatively in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Count-positive-record-by-id-cumulatively/m-p/757765#M239218</link>
    <description>&lt;P&gt;Perfect! Thank you. I'll ask questions per those instructions now.&lt;/P&gt;</description>
    <pubDate>Wed, 28 Jul 2021 15:55:14 GMT</pubDate>
    <dc:creator>erin3</dc:creator>
    <dc:date>2021-07-28T15:55:14Z</dc:date>
    <item>
      <title>Count positive record by id cumulatively</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-positive-record-by-id-cumulatively/m-p/757698#M239198</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm working with data like the first table below where I have multiple records per id, some are positive some are negative (1 and 0, respectively). I also know whether there was a previous record, where the first instance is not 1, but each row for that id number afterward is. I want to get a count variable like the second table which cumulatively counts each record per id number.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried some sql coding and a data step using the retain statement but can't get it quite right. Please help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="erin3_0-1627481411138.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/61945iA44E5448DEEC29CF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="erin3_0-1627481411138.png" alt="erin3_0-1627481411138.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="erin3_1-1627481432622.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/61946i36D7344296E22FC9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="erin3_1-1627481432622.png" alt="erin3_1-1627481432622.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jul 2021 14:10:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-positive-record-by-id-cumulatively/m-p/757698#M239198</guid>
      <dc:creator>erin3</dc:creator>
      <dc:date>2021-07-28T14:10:56Z</dc:date>
    </item>
    <item>
      <title>Re: Count positive record by id cumulatively</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-positive-record-by-id-cumulatively/m-p/757701#M239199</link>
      <description>&lt;P&gt;UNTESTED CODE&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
    by id;
    if first.id then count_record=0;
    count_record+record;
run;
    &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In the future, from now on (that's 100% of the time from now on) you need to post your data not as a screen capture, but as a SAS data step, by following &lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_self"&gt;these instructions&lt;/A&gt;&amp;nbsp;and then people can provide you with TESTED code.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jul 2021 14:17:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-positive-record-by-id-cumulatively/m-p/757701#M239199</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-07-28T14:17:34Z</dc:date>
    </item>
    <item>
      <title>Re: Count positive record by id cumulatively</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-positive-record-by-id-cumulatively/m-p/757765#M239218</link>
      <description>&lt;P&gt;Perfect! Thank you. I'll ask questions per those instructions now.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jul 2021 15:55:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-positive-record-by-id-cumulatively/m-p/757765#M239218</guid>
      <dc:creator>erin3</dc:creator>
      <dc:date>2021-07-28T15:55:14Z</dc:date>
    </item>
  </channel>
</rss>

