<?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: scanning a row to find 2 consecutive values that are equal in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/scanning-a-row-to-find-2-consecutive-values-that-are-equal/m-p/322451#M71331</link>
    <description>&lt;P&gt;Thanks for the info. I need to think through my data some more and what I really want to accomplish.&lt;/P&gt;</description>
    <pubDate>Wed, 04 Jan 2017 17:50:41 GMT</pubDate>
    <dc:creator>GreggB</dc:creator>
    <dc:date>2017-01-04T17:50:41Z</dc:date>
    <item>
      <title>scanning a row to find 2 consecutive values that are equal</title>
      <link>https://communities.sas.com/t5/SAS-Programming/scanning-a-row-to-find-2-consecutive-values-that-are-equal/m-p/319666#M70266</link>
      <description>&lt;P&gt;My data set consists of grade progressions of students over 13 school years (04-05 to 16-17). Every student identified has been retained at least once during his/her enrollment in our system. &lt;U&gt;My task&lt;/U&gt; is to identify which school year the retention occured. The header row represents the school year, e.g. grade17 is the 16-17 school year, grade16 is the 1516 school year, etc. The values represent the grade the student was in. A zero stands for kindergarten; a missing value means the student was not enrolled in that particular year.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Student 1 should be flagged as being retained in grade 12 after the 14-15 school year and the 15-16 school year.&lt;/P&gt;
&lt;P&gt;Student 2&amp;nbsp;&lt;SPAN&gt;should be flagged as being retained in grade 10 after 13-14 school year.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Student 3&amp;nbsp;should be flagged as being retained in grade 0 (kindergarten) after the 05-06 school year.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 672pt;" border="0" width="896" cellspacing="0" cellpadding="0"&gt;&lt;COLGROUP&gt;&lt;COL style="width: 48pt;" span="14" width="64" /&gt; &lt;/COLGROUP&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.75pt;"&gt;
&lt;TD width="64" height="21" class="xl63" style="height: 15.75pt; width: 48pt;"&gt;ID&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;grade17&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;grade16&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;grade15&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;grade14&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;grade13&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;grade12&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;grade11&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;grade10&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;grade09&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;grade08&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;grade07&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;grade06&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;grade05&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.75pt;"&gt;
&lt;TD width="64" height="21" class="xl63" style="height: 15.75pt; width: 48pt;"&gt;1&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;12&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;12&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;12&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;11&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;10&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;9&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;9&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;7&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;6&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;5&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;4&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;3&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.75pt;"&gt;
&lt;TD width="64" height="21" class="xl63" style="height: 15.75pt; width: 48pt;"&gt;2&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;12&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;11&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;10&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;10&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;9&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;.&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;.&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;.&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;.&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;.&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;.&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;.&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="64" height="20" class="xl63" style="height: 15.0pt; width: 48pt;"&gt;3&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;10&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;9&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;8&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;7&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;6&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;5&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;4&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;3&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;2&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;1&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;0&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;0&lt;/TD&gt;
&lt;TD width="64" class="xl64" style="width: 48pt;"&gt;.&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Fri, 16 Dec 2016 21:20:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/scanning-a-row-to-find-2-consecutive-values-that-are-equal/m-p/319666#M70266</guid>
      <dc:creator>GreggB</dc:creator>
      <dc:date>2016-12-16T21:20:33Z</dc:date>
    </item>
    <item>
      <title>Re: scanning a row to find 2 consecutive values that are equal</title>
      <link>https://communities.sas.com/t5/SAS-Programming/scanning-a-row-to-find-2-consecutive-values-that-are-equal/m-p/319669#M70269</link>
      <description>&lt;P&gt;Is number 1 i your example correct?&lt;/P&gt;</description>
      <pubDate>Fri, 16 Dec 2016 21:31:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/scanning-a-row-to-find-2-consecutive-values-that-are-equal/m-p/319669#M70269</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-12-16T21:31:10Z</dc:date>
    </item>
    <item>
      <title>Re: scanning a row to find 2 consecutive values that are equal</title>
      <link>https://communities.sas.com/t5/SAS-Programming/scanning-a-row-to-find-2-consecutive-values-that-are-equal/m-p/319673#M70272</link>
      <description>&lt;P&gt;Arrays are one of the easiest ways to do this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Look at the example titled&amp;nbsp;&lt;/P&gt;
&lt;H4&gt;&lt;A href="http://www.ats.ucla.edu/stat/sas/seminars/SAS_arrays/" target="_self"&gt;Identify patterns across variables using arrays&lt;/A&gt;&lt;/H4&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Dec 2016 21:32:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/scanning-a-row-to-find-2-consecutive-values-that-are-equal/m-p/319673#M70272</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-12-16T21:32:40Z</dc:date>
    </item>
    <item>
      <title>Re: scanning a row to find 2 consecutive values that are equal</title>
      <link>https://communities.sas.com/t5/SAS-Programming/scanning-a-row-to-find-2-consecutive-values-that-are-equal/m-p/319676#M70273</link>
      <description>&lt;P&gt;What actual VALUE do you want in your flag variable? it is not clear from your question what your output data set would look like.&lt;/P&gt;
&lt;P&gt;Also what is the actual rule when there are multiple choices such as with ID=1?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This will set a flag for the "latest" grade for a student or none if there are no sequences.&lt;/P&gt;
&lt;PRE&gt;data want;
   set have;
   array g {5:17} grade05-grade17;
   do i = 17 to 6 by -1;
      if not missing(g[i]) and g[i-1] = g[i] then do;
        Flag=g[i];
        leave;
      end;
   end;
run;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Dec 2016 21:44:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/scanning-a-row-to-find-2-consecutive-values-that-are-equal/m-p/319676#M70273</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-12-16T21:44:10Z</dc:date>
    </item>
    <item>
      <title>Re: scanning a row to find 2 consecutive values that are equal</title>
      <link>https://communities.sas.com/t5/SAS-Programming/scanning-a-row-to-find-2-consecutive-values-that-are-equal/m-p/319919#M70376</link>
      <description>&lt;P&gt;Yes, it's correct. He was retained twice. I may have to ignore multiple retentions. There's &amp;nbsp; &amp;nbsp;only a handful.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2016 14:06:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/scanning-a-row-to-find-2-consecutive-values-that-are-equal/m-p/319919#M70376</guid>
      <dc:creator>GreggB</dc:creator>
      <dc:date>2016-12-19T14:06:28Z</dc:date>
    </item>
    <item>
      <title>Re: scanning a row to find 2 consecutive values that are equal</title>
      <link>https://communities.sas.com/t5/SAS-Programming/scanning-a-row-to-find-2-consecutive-values-that-are-equal/m-p/319921#M70378</link>
      <description>&lt;P&gt;I actually need 2 flags - one to show the grade in which the student was retained and the other to show when he was retained. For student 2, it would grade_retained = 10 and when_retained = grade14&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2016 14:10:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/scanning-a-row-to-find-2-consecutive-values-that-are-equal/m-p/319921#M70378</guid>
      <dc:creator>GreggB</dc:creator>
      <dc:date>2016-12-19T14:10:26Z</dc:date>
    </item>
    <item>
      <title>Re: scanning a row to find 2 consecutive values that are equal</title>
      <link>https://communities.sas.com/t5/SAS-Programming/scanning-a-row-to-find-2-consecutive-values-that-are-equal/m-p/322451#M71331</link>
      <description>&lt;P&gt;Thanks for the info. I need to think through my data some more and what I really want to accomplish.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2017 17:50:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/scanning-a-row-to-find-2-consecutive-values-that-are-equal/m-p/322451#M71331</guid>
      <dc:creator>GreggB</dc:creator>
      <dc:date>2017-01-04T17:50:41Z</dc:date>
    </item>
    <item>
      <title>Re: scanning a row to find 2 consecutive values that are equal</title>
      <link>https://communities.sas.com/t5/SAS-Programming/scanning-a-row-to-find-2-consecutive-values-that-are-equal/m-p/322452#M71332</link>
      <description>&lt;P&gt;Thank you for the code. I need to think more about what I want as my end result.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2017 17:51:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/scanning-a-row-to-find-2-consecutive-values-that-are-equal/m-p/322452#M71332</guid>
      <dc:creator>GreggB</dc:creator>
      <dc:date>2017-01-04T17:51:51Z</dc:date>
    </item>
  </channel>
</rss>

