<?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: how to flag consecutive values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-flag-consecutive-values/m-p/113302#M23364</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hmm, something like this may work:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data = bob;by subjid lbtestcd lbdy;run;&lt;/P&gt;&lt;P&gt;data bob_1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set bob;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; by subjid lbtestcd lbdy;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; prev_e = lag(flag1);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; prev_visit = lag(lbdy);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if first.subjid then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; prev_e = .;prev_visit = .;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;yes_prior = (prev_e = flag1);*&lt;STRONG&gt;flag that there is a prior 'e';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;consecutive = ( lbdy - prev_visit = 1);*&lt;STRONG&gt;flag that there are consecutive visits;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;what_you_want = (yes_prior = 1 &amp;amp; consecutive = 1);*&lt;STRONG&gt;the flag you are looking for, I think;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best of luck!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anca.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 03 Jan 2013 20:01:26 GMT</pubDate>
    <dc:creator>AncaTilea</dc:creator>
    <dc:date>2013-01-03T20:01:26Z</dc:date>
    <item>
      <title>how to flag consecutive values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-flag-consecutive-values/m-p/113301#M23363</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have this querry...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have a dataset like this and i want to flag it where i have consecutive values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 12pt; font-family: 'Times New Roman', serif;"&gt;&lt;SPAN style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt; bob;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: 'Times New Roman', serif;"&gt;&lt;SPAN style="color: blue; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;input&lt;/SPAN&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt; subjid lbtestcd$ lbdy flag1$;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: 'Times New Roman', serif;"&gt;&lt;SPAN style="color: blue; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;datalines&lt;/SPAN&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: #ffffc0; font-family: 'Courier New';"&gt;101 alt 1 e&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: #ffffc0; font-family: 'Courier New';"&gt;101 alt 2 .&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: #ffffc0; font-family: 'Courier New';"&gt;101 alt 3 e&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: #ffffc0; font-family: 'Courier New';"&gt;101 alt 4 e&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: #ffffc0; font-family: 'Courier New';"&gt;101 ast 1 e&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: #ffffc0; font-family: 'Courier New';"&gt;101 ast 3 e&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: #ffffc0; font-family: 'Courier New';"&gt;101 ast 4 .&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: #ffffc0; font-family: 'Courier New';"&gt;101 ast 5 e&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: #ffffc0; font-family: 'Courier New';"&gt;102 alt 1 e&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: #ffffc0; font-family: 'Courier New';"&gt;102 alt 2 .&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: #ffffc0; font-family: 'Courier New';"&gt;102 alt 3 e&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: #ffffc0; font-family: 'Courier New';"&gt;102 alt 4 e&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: #ffffc0; font-family: 'Courier New';"&gt;102 ast 1 e&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: #ffffc0; font-family: 'Courier New';"&gt;102 ast 3 e&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: #ffffc0; font-family: 'Courier New';"&gt;102 ast 4 .&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: #ffffc0; font-family: 'Courier New';"&gt;102 ast 5 e&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: #ffffc0; font-family: 'Courier New';"&gt;102 ast 6 e&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: 'Times New Roman', serif;"&gt;&lt;SPAN style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;i want an output like &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;i want to flag consecutive 'e' values for consecutive visits by subject and test.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;could you please help me out&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;thanks.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Jan 2013 16:34:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-flag-consecutive-values/m-p/113301#M23363</guid>
      <dc:creator>rams</dc:creator>
      <dc:date>2013-01-03T16:34:44Z</dc:date>
    </item>
    <item>
      <title>Re: how to flag consecutive values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-flag-consecutive-values/m-p/113302#M23364</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hmm, something like this may work:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data = bob;by subjid lbtestcd lbdy;run;&lt;/P&gt;&lt;P&gt;data bob_1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set bob;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; by subjid lbtestcd lbdy;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; prev_e = lag(flag1);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; prev_visit = lag(lbdy);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if first.subjid then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; prev_e = .;prev_visit = .;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;yes_prior = (prev_e = flag1);*&lt;STRONG&gt;flag that there is a prior 'e';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;consecutive = ( lbdy - prev_visit = 1);*&lt;STRONG&gt;flag that there are consecutive visits;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;what_you_want = (yes_prior = 1 &amp;amp; consecutive = 1);*&lt;STRONG&gt;the flag you are looking for, I think;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best of luck!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anca.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Jan 2013 20:01:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-flag-consecutive-values/m-p/113302#M23364</guid>
      <dc:creator>AncaTilea</dc:creator>
      <dc:date>2013-01-03T20:01:26Z</dc:date>
    </item>
    <item>
      <title>Re: how to flag consecutive values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-flag-consecutive-values/m-p/113303#M23365</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Perhaps a simpler way to go:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=bob;&lt;/P&gt;&lt;P&gt;by subjid lbtestcd lbdy;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; set bob;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; by subjid lbtestcd flag1 notsorted;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if lbtestcd='e' and (first.flag1=0 or last.flag1=0) then new_flag='*';&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Depending on what you need, you could remove one condition:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if (first.flag1=0 or last.flag1=0) then new_flag='*';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Jan 2013 22:21:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-flag-consecutive-values/m-p/113303#M23365</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2013-01-03T22:21:15Z</dc:date>
    </item>
    <item>
      <title>Re: how to flag consecutive values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-flag-consecutive-values/m-p/113304#M23366</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 8pt; background: white; font-family: 'Courier New';"&gt;Hello Rams,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 8pt; background: white; font-family: 'Courier New';"&gt;Is the outcome below ("RESULTS") what you desire? I'm not sure I have understood the question.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 8pt; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt; bob;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 8pt;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt; subjid lbtestcd$ lbdy flag1$;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 8pt;"&gt;datalines&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 8pt;"&gt;101 alt 1 e&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 8pt;"&gt;101 alt 2 .&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 8pt;"&gt;101 alt 3 e&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 8pt;"&gt;101 alt 4 e&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 8pt;"&gt;101 ast 1 e&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 8pt;"&gt;101 ast 3 e&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 8pt;"&gt;101 ast 4 .&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 8pt;"&gt;101 ast 5 e&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 8pt;"&gt;102 alt 1 e&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 8pt;"&gt;102 alt 2 .&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 8pt;"&gt;102 alt 3 e&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 8pt;"&gt;102 alt 4 e&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 8pt;"&gt;102 ast 1 e&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 8pt;"&gt;102 ast 3 e&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 8pt;"&gt;102 ast 4 .&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 8pt;"&gt;102 ast 5 e&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black; font-size: 8pt;"&gt;102 ast 6 e&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 8pt; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 8pt; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt; want(keep=subjid lbtestcd lbdy flag1 flag2);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-indent: 0.5in;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 8pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 8pt; background: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt;=&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 8pt; background: white; font-family: 'Courier New';"&gt;2&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt;) &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 8pt;"&gt;then&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 8pt;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt; bob;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 8pt;"&gt;declare&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt; hash f(ordered:&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 8pt;"&gt;"a"&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt;,multidata:&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 8pt;"&gt;"y"&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-indent: 0.5in; margin: 0px 0px 0px 0.5in;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt;rc=f.defineKey(&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 8pt;"&gt;"subjid"&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 8pt;"&gt;"lbtestcd"&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 8pt;"&gt;"flag2"&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-indent: 0.5in; margin: 0px 0px 0px 0.5in;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt;rc=f.defineData(&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 8pt;"&gt;"subjid"&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 8pt;"&gt;"lbtestcd"&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 8pt;"&gt;"lbdy"&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 8pt;"&gt;"flag1"&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 8pt;"&gt;"flag2"&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-indent: 0.5in; margin: 0px 0px 0px 0.5in;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt;rc=f.defineDone();&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-indent: 0.5in;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 8pt;"&gt;length&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt; flag2 $&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 8pt; background: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-indent: 0.5in;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt;flag2=&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 8pt;"&gt;""&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-indent: 0.5in;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 8pt;"&gt;do&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 8pt;"&gt;until&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt;(done);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-indent: 0.5in; margin: 0px 0px 0px 0.5in;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 8pt;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt; bob end=done;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-indent: 0.5in; margin: 0px 0px 0px 0.5in;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt;rcf=f.check();&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-indent: 0.5in; margin: 0px 0px 0px 0.5in;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 8pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt; (missing(flag1)+rcf)=&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 8pt; background: white; font-family: 'Courier New';"&gt;0&lt;/STRONG&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 8pt;"&gt;then&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 8pt;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-indent: 0.5in; margin: 0px 0px 0px 1in;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt;flag2=&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 8pt;"&gt;"Y";&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-indent: 0.5in; margin: 0px 0px 0px 1in;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt;f.add();&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-indent: 0.5in; margin: 0px 0px 0px 0.5in;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 8pt;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-indent: 0.5in;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 8pt;"&gt;else&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 8pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt; rcf ne &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 8pt; background: white; font-family: 'Courier New';"&gt;0&lt;/STRONG&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 8pt;"&gt;then&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt; f.add();&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-indent: 0.5in;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 8pt;"&gt;else&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 8pt;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt; missing(flag1) &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 8pt;"&gt;then&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt; f.remove();&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-indent: 0.5in;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 8pt;"&gt;output&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-indent: 0.5in;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 8pt;"&gt;call&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt; missing(of _all_);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-indent: 0.5in;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 8pt;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-indent: 0.5in;"&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 8pt;"&gt;stop&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 8pt; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 8pt;"&gt; RESULTS:&lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE border="1" cellpadding="0" cellspacing="0" style="background: white; padding: 1.5pt;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD style="background: #f0f0f0; padding: 1.5pt;"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;STRONG style="font-size: 12pt; font-family: 'Times New Roman','serif';"&gt;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="background: #f0f0f0; padding: 1.5pt;"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;STRONG style="color: black; font-size: 12pt; font-family: 'Times New Roman','serif';"&gt;subjid &lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="background: #f0f0f0; padding: 1.5pt;"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;STRONG style="color: black; font-size: 12pt; font-family: 'Times New Roman','serif';"&gt;lbtestcd &lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="background: #f0f0f0; padding: 1.5pt;"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;STRONG style="color: black; font-size: 12pt; font-family: 'Times New Roman','serif';"&gt;lbdy &lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="background: #f0f0f0; padding: 1.5pt;"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;STRONG style="color: black; font-size: 12pt; font-family: 'Times New Roman','serif';"&gt;flag1 &lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="background: #f0f0f0; padding: 1.5pt;"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;STRONG style="color: black; font-size: 12pt; font-family: 'Times New Roman','serif';"&gt;flag2 &lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="background: #f0f0f0; padding: 1.5pt;"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;STRONG style="color: black; font-size: 12pt; font-family: 'Times New Roman','serif';"&gt;1 &lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt;"&gt;101 &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt;"&gt;alt &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt;"&gt;1 &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt;"&gt;e &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; font-size: 12pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="background: #f0f0f0; padding: 1.5pt;"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;STRONG style="color: black; font-size: 12pt; font-family: 'Times New Roman','serif';"&gt;2 &lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt;"&gt;101 &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt;"&gt;alt &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt;"&gt;2 &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; font-size: 12pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; font-size: 12pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="background: #f0f0f0; padding: 1.5pt;"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;STRONG style="color: black; font-size: 12pt; font-family: 'Times New Roman','serif';"&gt;3 &lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt;"&gt;101 &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt;"&gt;alt &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt;"&gt;3 &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt;"&gt;e &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; font-size: 12pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="background: #f0f0f0; padding: 1.5pt;"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;STRONG style="color: black; font-size: 12pt; font-family: 'Times New Roman','serif';"&gt;4 &lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt;"&gt;101 &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt;"&gt;alt &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt;"&gt;4 &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt;"&gt;e &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt;"&gt;Y &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="background: #f0f0f0; padding: 1.5pt;"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;STRONG style="color: black; font-size: 12pt; font-family: 'Times New Roman','serif';"&gt;5 &lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt;"&gt;101 &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt;"&gt;ast &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt;"&gt;1 &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt;"&gt;e &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; font-size: 12pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="background: #f0f0f0; padding: 1.5pt;"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;STRONG style="color: black; font-size: 12pt; font-family: 'Times New Roman','serif';"&gt;6 &lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt;"&gt;101 &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt;"&gt;ast &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt;"&gt;3 &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt;"&gt;e &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt;"&gt;Y &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="background: #f0f0f0; padding: 1.5pt;"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;STRONG style="color: black; font-size: 12pt; font-family: 'Times New Roman','serif';"&gt;7 &lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt;"&gt;101 &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt;"&gt;ast &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt;"&gt;4 &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; font-size: 12pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; font-size: 12pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="background: #f0f0f0; padding: 1.5pt;"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;STRONG style="color: black; font-size: 12pt; font-family: 'Times New Roman','serif';"&gt;8 &lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt;"&gt;101 &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt;"&gt;ast &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt;"&gt;5 &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt;"&gt;e &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; font-size: 12pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="background: #f0f0f0; padding: 1.5pt;"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;STRONG style="color: black; font-size: 12pt; font-family: 'Times New Roman','serif';"&gt;9 &lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt;"&gt;102 &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt;"&gt;alt &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt;"&gt;1 &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt;"&gt;e &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; font-size: 12pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="background: #f0f0f0; padding: 1.5pt;"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;STRONG style="color: black; font-size: 12pt; font-family: 'Times New Roman','serif';"&gt;10 &lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt;"&gt;102 &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt;"&gt;alt &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt;"&gt;2 &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; font-size: 12pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; font-size: 12pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="background: #f0f0f0; padding: 1.5pt;"&gt;&lt;P align="center" style="text-align: center;"&gt;&lt;STRONG style="color: black; font-size: 12pt; font-family: 'Times New Roman','serif';"&gt;11 &lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt;"&gt;102 &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt;"&gt;alt &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P align="right" style="text-align: right;"&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt;"&gt;3 &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt;"&gt;e &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="padding: 1.5pt;"&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman','serif'; font-size: 12pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Jan 2013 21:49:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-flag-consecutive-values/m-p/113304#M23366</guid>
      <dc:creator>joehinson</dc:creator>
      <dc:date>2013-01-04T21:49:29Z</dc:date>
    </item>
    <item>
      <title>Re: how to flag consecutive values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-flag-consecutive-values/m-p/582574#M165709</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;Building on this solution, I wonder how to flag&amp;nbsp;the subject ID where to have four consecutive values='e' other than at least two.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Ethan&lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2019 19:58:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-flag-consecutive-values/m-p/582574#M165709</guid>
      <dc:creator>t75wez1</dc:creator>
      <dc:date>2019-08-20T19:58:09Z</dc:date>
    </item>
    <item>
      <title>Re: how to flag consecutive values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-flag-consecutive-values/m-p/582579#M165712</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
    prev_subjid=lag(subjid)
    prev2_subjid=lag2(subjid);
    prev3_subjid=lag3(subjid);
    prev_flag1=lag(flag1);
    prev2_flag1=lag2(flag1);
    prev3_flag1=lag3(flag1);
    if subjid=prev_subjid and subjid=prev2_subjid and subjid=prev3_subjid
        and flag1='e' and prev_flag1='e' and prev2_flag1='e' and prev3_flag1='e'
        then flag2='Y';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 20 Aug 2019 20:10:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-flag-consecutive-values/m-p/582579#M165712</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-08-20T20:10:36Z</dc:date>
    </item>
    <item>
      <title>Re: how to flag consecutive values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-flag-consecutive-values/m-p/582613#M165741</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/38900"&gt;@rams&lt;/a&gt;:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;You're making the readers of your post&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;guess&lt;/EM&gt;&lt;/STRONG&gt; what kind of output you need.&lt;/LI&gt;
&lt;LI&gt;The verbal description you've offered is very ambiguous and allows for a number of interpretations.&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;Please &lt;STRONG&gt;&lt;EM&gt;show&lt;/EM&gt;&lt;/STRONG&gt; the exact output you want given the input you have shown.&amp;nbsp;&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;If you did, your problem would be solved sooner, and those volunteering their precious time to help you out wouldn't have to waste it trying to divine what output you may have in mind.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind regards&lt;/P&gt;
&lt;P&gt;Paul D.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2019 21:57:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-flag-consecutive-values/m-p/582613#M165741</guid>
      <dc:creator>hashman</dc:creator>
      <dc:date>2019-08-20T21:57:24Z</dc:date>
    </item>
    <item>
      <title>Re: how to flag consecutive values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-flag-consecutive-values/m-p/582652#M165768</link>
      <description>&lt;P&gt;My desired output data set&amp;nbsp;with new variable&amp;nbsp;named "newflag"&amp;nbsp; shown below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 8pt;"&gt;subjid lbtestcd$ lbdy flag1 newflag&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;101 alt 1 e 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;101 alt 2 . 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;101 alt 3 e 4&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;101 alt 4 e 4&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;101 ast 1 e 4&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;101 ast 3 e 4&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;101 ast 4 . 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;101 ast 5 e 2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;102 alt 1 e 2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;102 alt 2 .&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;102 alt 3 e 4&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;102 alt 4 e 4&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;102 ast 1 e 4&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;102 ast 3 e 4&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;102 ast 4 .&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;102 ast 5 e 2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;102 ast 6 e 2&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 01:33:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-flag-consecutive-values/m-p/582652#M165768</guid>
      <dc:creator>t75wez1</dc:creator>
      <dc:date>2019-08-21T01:33:53Z</dc:date>
    </item>
    <item>
      <title>Re: how to flag consecutive values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-flag-consecutive-values/m-p/582658#M165772</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/23924"&gt;@t75wez1&lt;/a&gt;&amp;nbsp;:&lt;/P&gt;
&lt;P&gt;This suggested output totally defies your verbal description in the original post. To wit, it's not "by subject and test" but merely by FLAG1.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyway, this should work:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ;                                     
  input subjid lbtestcd $ lbdy flag1 $ ;        
  cards ;                                       
101 alt 1 e                                     
101 alt 2 .                                     
101 alt 3 e                                     
101 alt 4 e                                     
101 ast 1 e                                     
101 ast 3 e                                     
101 ast 4 .                                     
101 ast 5 e                                     
102 alt 1 e                                     
102 alt 2 .                                     
102 alt 3 e                                     
102 alt 4 e                                     
102 ast 1 e                                     
102 ast 3 e                                     
102 ast 4 .                                     
102 ast 5 e                                     
102 ast 6 e                                     
run ;                                           
                            
data want ;                                     
  do _n_ = 1 by 1 until (last.flag1) ;          
    set have ;                                  
    by flag1 notsorted ;                        
    newflag = sum (newflag, 1) ;                
  end ;                                         
  if cmiss (flag1) or _n_ &amp;lt; 2 then newflag = 0 ;
  do _n_ = 1 to _n_ ;                           
    set have ;                                  
    output ;                                    
  end ;                                         
run ;                                           
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Apropos, I see no I/O logic vis-a-vis setting the NEWFLAG to 0 or blank (do you mean a missing value by that? kind of odd since the variable is numeric). Hence, whenever it's "non-consecutive", the code above sets it to 0.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind regards&lt;/P&gt;
&lt;P&gt;Paul D.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 04:18:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-flag-consecutive-values/m-p/582658#M165772</guid>
      <dc:creator>hashman</dc:creator>
      <dc:date>2019-08-21T04:18:48Z</dc:date>
    </item>
  </channel>
</rss>

