<?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 determining first encounter of event in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/determining-first-encounter-of-event/m-p/665879#M199160</link>
    <description>&lt;P&gt;How can I determine the first encounter of the condition and flag it? I need to flag that 'M' had occurred on 06/02/2020 so I can not count cond 'M' as the first encounter on 06/12/2020.&lt;/P&gt;&lt;PRE&gt;data wide ; &lt;BR /&gt;  input id $ date MMDDYY10. cond1 $ cond2 $; &lt;BR /&gt;  format date date9.;&lt;BR /&gt;datalines ; &lt;BR /&gt;1 06/02/2020 M Z&lt;BR /&gt;1 06/12/2020 B M  &lt;BR /&gt;2 06/22/2020 M B&lt;BR /&gt;   &lt;BR /&gt;; &lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 29 Jun 2020 18:08:34 GMT</pubDate>
    <dc:creator>sbopster</dc:creator>
    <dc:date>2020-06-29T18:08:34Z</dc:date>
    <item>
      <title>determining first encounter of event</title>
      <link>https://communities.sas.com/t5/SAS-Programming/determining-first-encounter-of-event/m-p/665879#M199160</link>
      <description>&lt;P&gt;How can I determine the first encounter of the condition and flag it? I need to flag that 'M' had occurred on 06/02/2020 so I can not count cond 'M' as the first encounter on 06/12/2020.&lt;/P&gt;&lt;PRE&gt;data wide ; &lt;BR /&gt;  input id $ date MMDDYY10. cond1 $ cond2 $; &lt;BR /&gt;  format date date9.;&lt;BR /&gt;datalines ; &lt;BR /&gt;1 06/02/2020 M Z&lt;BR /&gt;1 06/12/2020 B M  &lt;BR /&gt;2 06/22/2020 M B&lt;BR /&gt;   &lt;BR /&gt;; &lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jun 2020 18:08:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/determining-first-encounter-of-event/m-p/665879#M199160</guid>
      <dc:creator>sbopster</dc:creator>
      <dc:date>2020-06-29T18:08:34Z</dc:date>
    </item>
    <item>
      <title>Re: determining first encounter of event</title>
      <link>https://communities.sas.com/t5/SAS-Programming/determining-first-encounter-of-event/m-p/665881#M199162</link>
      <description>&lt;P&gt;So if we can't take the first occurrence what is the rule that says we can use the second?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is it that must occur in a specific variable? Only as the second mention regardless of variable? Something else?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the rule is a bit complicated you may need to provide more examples of the types of combinations occur and then indicate which are counted.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It will also help if show what the output should look like.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jun 2020 18:13:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/determining-first-encounter-of-event/m-p/665881#M199162</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-06-29T18:13:55Z</dc:date>
    </item>
    <item>
      <title>Re: determining first encounter of event</title>
      <link>https://communities.sas.com/t5/SAS-Programming/determining-first-encounter-of-event/m-p/665890#M199168</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data wide ; 
  input id $ date MMDDYY10. cond1 $ cond2 $; 
  format date date9.;
datalines ; 
1 06/02/2020 M Z
1 06/12/2020 B M  
2 06/22/2020 M B
   
; 
run;
proc transpose data=wide out=tall;
by id date;
var cond:;
run;

proc sort; by id col1 date;
run;

data tall;
set tall;
by id col1 date;
if first.col1;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;By using the above code you get first encounter for each of the conditions. Is this what you want?&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jun 2020 18:31:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/determining-first-encounter-of-event/m-p/665890#M199168</guid>
      <dc:creator>smantha</dc:creator>
      <dc:date>2020-06-29T18:31:55Z</dc:date>
    </item>
    <item>
      <title>Re: determining first encounter of event</title>
      <link>https://communities.sas.com/t5/SAS-Programming/determining-first-encounter-of-event/m-p/665996#M199213</link>
      <description>&lt;P&gt;yes that works. I was using an array. thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jun 2020 06:05:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/determining-first-encounter-of-event/m-p/665996#M199213</guid>
      <dc:creator>sbopster</dc:creator>
      <dc:date>2020-06-30T06:05:52Z</dc:date>
    </item>
  </channel>
</rss>

