<?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 cumulative by groups in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Count-cumulative-by-groups/m-p/870303#M343751</link>
    <description>&lt;P&gt;Assuming that your data is sorted by OBJ and DATE (meaning that missing dates come first) this should do it&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  by obj date;
  if first.obj then count=not missing(date);
  else count+first.date;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 18 Apr 2023 07:44:40 GMT</pubDate>
    <dc:creator>s_lassen</dc:creator>
    <dc:date>2023-04-18T07:44:40Z</dc:date>
    <item>
      <title>Count cumulative by groups</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-cumulative-by-groups/m-p/870278#M343746</link>
      <description>&lt;P&gt;Hi, I have below table that I want to count by Obj and if same date then this can be ignored as same count. If date is zero then want is zero.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 162pt;" border="0" width="216" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 14.25pt;"&gt;
&lt;TD width="72" height="19" style="height: 14.25pt; width: 54pt;"&gt;Obj&lt;/TD&gt;
&lt;TD width="72" style="width: 54pt;"&gt;Dates&lt;/TD&gt;
&lt;TD width="72" style="width: 54pt;"&gt;Want&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.25pt;"&gt;
&lt;TD height="19" style="height: 14.25pt;"&gt;a&lt;/TD&gt;
&lt;TD align="right" class="xl63"&gt;1/01/2020&lt;/TD&gt;
&lt;TD align="right"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.25pt;"&gt;
&lt;TD height="19" style="height: 14.25pt;"&gt;a&lt;/TD&gt;
&lt;TD align="right" class="xl63"&gt;1/01/2020&lt;/TD&gt;
&lt;TD align="right"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.25pt;"&gt;
&lt;TD height="19" style="height: 14.25pt;"&gt;a&lt;/TD&gt;
&lt;TD align="right" class="xl63"&gt;2/01/2020&lt;/TD&gt;
&lt;TD align="right"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.25pt;"&gt;
&lt;TD height="19" style="height: 14.25pt;"&gt;a&lt;/TD&gt;
&lt;TD align="right" class="xl63"&gt;3/01/2020&lt;/TD&gt;
&lt;TD align="right"&gt;3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.25pt;"&gt;
&lt;TD height="19" style="height: 14.25pt;"&gt;b&lt;/TD&gt;
&lt;TD&gt;.&lt;/TD&gt;
&lt;TD align="right"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Mon, 17 Apr 2023 23:34:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-cumulative-by-groups/m-p/870278#M343746</guid>
      <dc:creator>ywon111</dc:creator>
      <dc:date>2023-04-17T23:34:35Z</dc:date>
    </item>
    <item>
      <title>Re: Count cumulative by groups</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-cumulative-by-groups/m-p/870298#M343750</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
by obj;
if first.obj then want = 0;
if dates ne . and (obj ne lag(obj) or dates ne lag(dates)) then want + 1;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Apr 2023 05:31:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-cumulative-by-groups/m-p/870298#M343750</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-04-18T05:31:48Z</dc:date>
    </item>
    <item>
      <title>Re: Count cumulative by groups</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Count-cumulative-by-groups/m-p/870303#M343751</link>
      <description>&lt;P&gt;Assuming that your data is sorted by OBJ and DATE (meaning that missing dates come first) this should do it&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  by obj date;
  if first.obj then count=not missing(date);
  else count+first.date;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Apr 2023 07:44:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Count-cumulative-by-groups/m-p/870303#M343751</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2023-04-18T07:44:40Z</dc:date>
    </item>
  </channel>
</rss>

