<?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: Create seq for each group depend on Ind_Change in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Create-seq-for-each-group-depend-on-Ind-Change/m-p/957985#M373922</link>
    <description>&lt;P&gt;I think it is easy for you ,isn't it ? Since you are using sas for so many years.&lt;/P&gt;
&lt;PRE&gt;data have;
input CustID Ind_Change;
cards;
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
2 0
2 0
2 1
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
3 0
3 0
3 1
3 0
3 1
3 0
3 0
3 0
3 0
3 0
3 0
3 0
4 1
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
;
Run;
data want;
 set have;
 by CustID;
 if first.CustID then want=0;
 if first.CustID or Ind_Change=1 then want+1;
run;
&lt;/PRE&gt;</description>
    <pubDate>Mon, 03 Feb 2025 09:15:26 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2025-02-03T09:15:26Z</dc:date>
    <item>
      <title>Create seq for each group depend on Ind_Change</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-seq-for-each-group-depend-on-Ind-Change/m-p/957983#M373921</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;Lets say I want to create a seq by group by the following way.&lt;/P&gt;
&lt;P&gt;For each customer seq get same number until there is a change (Ind_change=1)&lt;/P&gt;
&lt;P&gt;What is the way to create want data set?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input CustID Ind_Change;
cards;
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
2 0
2 0
2 1
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
3 0
3 0
3 1
3 0
3 1
3 0
3 0
3 0
3 0
3 0
3 0
3 0
4 1
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
;
Run;

data want;
input CustID Ind_Change seq;
cards;
1 0 1
1 0 1
1 0 1
1 0 1
1 0 1
1 0 1
1 0 1
1 0 1
1 0 1
1 0 1
1 0 1
1 0 1
2 0 1
2 0 1
2 1 1
2 0 1
2 0 1
2 0 1
2 0 1
2 0 1
2 0 1
2 0 1
2 0 1
2 0 1
3 0 1
3 0 1
3 1 2
3 0 2
3 1 3
3 0 3
3 0 3
3 0 3
3 0 3
3 0 3
3 0 3
3 0 3
4 1 1
4 0 1
4 0 1
4 0 1
4 0 1
4 0 1
4 0 1
4 0 1
4 0 1
4 0 1
4 0 1
4 0 1
;
Run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2025 09:07:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-seq-for-each-group-depend-on-Ind-Change/m-p/957983#M373921</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2025-02-03T09:07:10Z</dc:date>
    </item>
    <item>
      <title>Re: Create seq for each group depend on Ind_Change</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-seq-for-each-group-depend-on-Ind-Change/m-p/957985#M373922</link>
      <description>&lt;P&gt;I think it is easy for you ,isn't it ? Since you are using sas for so many years.&lt;/P&gt;
&lt;PRE&gt;data have;
input CustID Ind_Change;
cards;
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
1 0
2 0
2 0
2 1
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
2 0
3 0
3 0
3 1
3 0
3 1
3 0
3 0
3 0
3 0
3 0
3 0
3 0
4 1
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
4 0
;
Run;
data want;
 set have;
 by CustID;
 if first.CustID then want=0;
 if first.CustID or Ind_Change=1 then want+1;
run;
&lt;/PRE&gt;</description>
      <pubDate>Mon, 03 Feb 2025 09:15:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-seq-for-each-group-depend-on-Ind-Change/m-p/957985#M373922</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-02-03T09:15:26Z</dc:date>
    </item>
  </channel>
</rss>

