<?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: jump over specific event under cumulative sum in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/jump-over-specific-event-under-cumulative-sum/m-p/496678#M131406</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input id surgery_YN;
datalines;
1 0
1 0
1 0
1 0
1 1
1 0
1 0
1 1
1 1
1 0
2 0
2 0
2 1
2 0
2 1
2 0
2 0
;
run;
proc sort data=have;
by id;

data want(drop=count_pre);
retain count;
set have;
by id;
if first.id then count_pre=0;
if surgery_YN^=0 then count_pre+1;
if surgery_YN=0 then count=0;
else count=count_pre;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 18 Sep 2018 18:40:58 GMT</pubDate>
    <dc:creator>SuryaKiran</dc:creator>
    <dc:date>2018-09-18T18:40:58Z</dc:date>
    <item>
      <title>jump over specific event under cumulative sum</title>
      <link>https://communities.sas.com/t5/SAS-Programming/jump-over-specific-event-under-cumulative-sum/m-p/496663#M131398</link>
      <description>&lt;P&gt;hello. i made data set, counting patient's surgery event.&lt;BR /&gt;&lt;BR /&gt;raw data is here. this is patient's billing data. it is ordered by date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;id surgery_YN&lt;/P&gt;&lt;P&gt;1 0&lt;BR /&gt;1 0&lt;BR /&gt;1 0&lt;BR /&gt;1 0&lt;BR /&gt;1 &lt;STRONG&gt;1&lt;/STRONG&gt;&lt;BR /&gt;1 0&lt;BR /&gt;1 0&lt;BR /&gt;1 &lt;STRONG&gt;1&lt;/STRONG&gt;&lt;BR /&gt;1 &lt;STRONG&gt;1&lt;/STRONG&gt;&lt;BR /&gt;1 0&lt;BR /&gt;2 0&lt;BR /&gt;2 0&lt;BR /&gt;2 &lt;STRONG&gt;1&lt;/STRONG&gt;&lt;BR /&gt;2 0&lt;BR /&gt;2 &lt;STRONG&gt;1&lt;/STRONG&gt;&lt;BR /&gt;2 0&lt;BR /&gt;2 0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and i want to count surgery event in cumulative sum and make other count zero. how can i jump over non-surgery event?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;id surgery_YN count&lt;/P&gt;&lt;P&gt;1 0 0&lt;BR /&gt;1 0 0&lt;BR /&gt;1 0 0&lt;BR /&gt;1 0 0&lt;BR /&gt;1 &lt;STRONG&gt;1 1&lt;/STRONG&gt;&lt;BR /&gt;1 0 0&lt;BR /&gt;1 0 0&lt;BR /&gt;1 &lt;STRONG&gt;1 2&lt;/STRONG&gt;&lt;BR /&gt;1 &lt;STRONG&gt;1 3&lt;/STRONG&gt;&lt;BR /&gt;1 0 0&lt;BR /&gt;2 0 0&lt;BR /&gt;2 0 0&lt;BR /&gt;2 &lt;STRONG&gt;1 1&lt;/STRONG&gt;&lt;BR /&gt;2 0 0&lt;BR /&gt;2 &lt;STRONG&gt;1 2&lt;/STRONG&gt;&lt;BR /&gt;2 0 0&lt;BR /&gt;2 0 0&lt;/P&gt;</description>
      <pubDate>Tue, 18 Sep 2018 18:21:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/jump-over-specific-event-under-cumulative-sum/m-p/496663#M131398</guid>
      <dc:creator>km0927</dc:creator>
      <dc:date>2018-09-18T18:21:49Z</dc:date>
    </item>
    <item>
      <title>Re: jump over specific event under cumulative sum</title>
      <link>https://communities.sas.com/t5/SAS-Programming/jump-over-specific-event-under-cumulative-sum/m-p/496678#M131406</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input id surgery_YN;
datalines;
1 0
1 0
1 0
1 0
1 1
1 0
1 0
1 1
1 1
1 0
2 0
2 0
2 1
2 0
2 1
2 0
2 0
;
run;
proc sort data=have;
by id;

data want(drop=count_pre);
retain count;
set have;
by id;
if first.id then count_pre=0;
if surgery_YN^=0 then count_pre+1;
if surgery_YN=0 then count=0;
else count=count_pre;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Sep 2018 18:40:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/jump-over-specific-event-under-cumulative-sum/m-p/496678#M131406</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2018-09-18T18:40:58Z</dc:date>
    </item>
    <item>
      <title>Re: jump over specific event under cumulative sum</title>
      <link>https://communities.sas.com/t5/SAS-Programming/jump-over-specific-event-under-cumulative-sum/m-p/496763#M131468</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input id surgery_YN;
datalines;
1 0
1 0
1 0
1 0
1 1
1 0
1 0
1 1
1 1
1 0
2 0
2 0
2 1
2 0
2 1
2 0
2 0
;
run;

data want;
set have;
by id;
if first.id then _iorc_=0;
count=surgery_YN;
if surgery_YN then do; _iorc_+surgery_YN;count=_iorc_;end;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Sep 2018 22:08:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/jump-over-specific-event-under-cumulative-sum/m-p/496763#M131468</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-09-18T22:08:00Z</dc:date>
    </item>
  </channel>
</rss>

