<?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: successor function in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/successor-function/m-p/36292#M9120</link>
    <description>You could try something like this:&lt;BR /&gt;
&lt;BR /&gt;
data new;&lt;BR /&gt;
  set old;&lt;BR /&gt;
  retain last_v1;&lt;BR /&gt;
  if last_v1 ne v1 then v2 +1;&lt;BR /&gt;
  last_v1 = v1;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
On the first row last_v1 will not be assigned so v2 is set to 1.&lt;BR /&gt;
&lt;BR /&gt;
On row 4, where there is a change v1 will not equal last_v1 so 1 is added to v2.</description>
    <pubDate>Wed, 16 Jun 2010 23:38:23 GMT</pubDate>
    <dc:creator>SASKiwi</dc:creator>
    <dc:date>2010-06-16T23:38:23Z</dc:date>
    <item>
      <title>successor function</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/successor-function/m-p/36291#M9119</link>
      <description>Hi.&lt;BR /&gt;
&lt;BR /&gt;
I want to do what seems to be something simple. Variable v2 should make an enumeration change when v1 changes. v1 need to come out in the unsorted way it is. How do I do this?&lt;BR /&gt;
&lt;BR /&gt;
v1     v2&lt;BR /&gt;
a      1&lt;BR /&gt;
a      1&lt;BR /&gt;
a      1&lt;BR /&gt;
c      2&lt;BR /&gt;
c      2&lt;BR /&gt;
b      3</description>
      <pubDate>Wed, 16 Jun 2010 22:31:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/successor-function/m-p/36291#M9119</guid>
      <dc:creator>blackraven</dc:creator>
      <dc:date>2010-06-16T22:31:30Z</dc:date>
    </item>
    <item>
      <title>Re: successor function</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/successor-function/m-p/36292#M9120</link>
      <description>You could try something like this:&lt;BR /&gt;
&lt;BR /&gt;
data new;&lt;BR /&gt;
  set old;&lt;BR /&gt;
  retain last_v1;&lt;BR /&gt;
  if last_v1 ne v1 then v2 +1;&lt;BR /&gt;
  last_v1 = v1;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
On the first row last_v1 will not be assigned so v2 is set to 1.&lt;BR /&gt;
&lt;BR /&gt;
On row 4, where there is a change v1 will not equal last_v1 so 1 is added to v2.</description>
      <pubDate>Wed, 16 Jun 2010 23:38:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/successor-function/m-p/36292#M9120</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2010-06-16T23:38:23Z</dc:date>
    </item>
  </channel>
</rss>

