<?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: Make indicator to split two incidence within each individ in sas in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Make-indicator-to-split-two-incidence-within-each-individ-in-sas/m-p/831519#M328608</link>
    <description>I only got index =1 in when seqn is 1 for this solution. I need also that index =1 for all 101 when seqn go from 1-3 , and index =2 when 1-2 in the next sequence in the same id number if you understand.</description>
    <pubDate>Fri, 02 Sep 2022 09:05:37 GMT</pubDate>
    <dc:creator>user40</dc:creator>
    <dc:date>2022-09-02T09:05:37Z</dc:date>
    <item>
      <title>Make indicator to split two incidence within each individ in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Make-indicator-to-split-two-incidence-within-each-individ-in-sas/m-p/831390#M328518</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to make an index that assign number 1 for each sequence start in the table below. I try this with the following code:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="code.JPG" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/74929i325A457A1E65C761/image-size/large?v=v2&amp;amp;px=999" role="button" title="code.JPG" alt="code.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="utskrift av tabell.JPG" style="width: 504px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/74928i2A0C3632EFD38429/image-size/large?v=v2&amp;amp;px=999" role="button" title="utskrift av tabell.JPG" alt="utskrift av tabell.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;But the problem is that i Want to have a new unique number for index when the sequence variable (seqn) start in the beginning again. Like 1 for seqn 1 , 2, and index=2 for seqn 1 until 14 in this example?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I solve this example?&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2022 11:32:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Make-indicator-to-split-two-incidence-within-each-individ-in-sas/m-p/831390#M328518</guid>
      <dc:creator>user40</dc:creator>
      <dc:date>2022-09-01T11:32:57Z</dc:date>
    </item>
    <item>
      <title>Re: Make indicator to split two incidence within each individ in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Make-indicator-to-split-two-incidence-within-each-individ-in-sas/m-p/831413#M328532</link>
      <description>&lt;P&gt;I can't tell what you want the output to look like.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: we can't code against pictures.&lt;/P&gt;
&lt;P&gt;It is best to provide data in the form of a data step. There are hundreds of examples on the forum for such.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2022 14:08:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Make-indicator-to-split-two-incidence-within-each-individ-in-sas/m-p/831413#M328532</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-09-01T14:08:50Z</dc:date>
    </item>
    <item>
      <title>Re: Make indicator to split two incidence within each individ in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Make-indicator-to-split-two-incidence-within-each-individ-in-sas/m-p/831414#M328533</link>
      <description>&lt;P&gt;I think this is what you want&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
   do seqnr = 1, 2, 1 to 14;
      output;
   end;
run;

data want;
   set have;
   if seqnr = 1 then index + 1;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Sep 2022 14:14:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Make-indicator-to-split-two-incidence-within-each-individ-in-sas/m-p/831414#M328533</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2022-09-01T14:14:11Z</dc:date>
    </item>
    <item>
      <title>Re: Make indicator to split two incidence within each individ in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Make-indicator-to-split-two-incidence-within-each-individ-in-sas/m-p/831508#M328600</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;My problem that I have many individuals in this file and this indicator must be done for each individ. How can I do that?&lt;BR /&gt;</description>
      <pubDate>Fri, 02 Sep 2022 07:30:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Make-indicator-to-split-two-incidence-within-each-individ-in-sas/m-p/831508#M328600</guid>
      <dc:creator>user40</dc:creator>
      <dc:date>2022-09-02T07:30:29Z</dc:date>
    </item>
    <item>
      <title>Re: Make indicator to split two incidence within each individ in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Make-indicator-to-split-two-incidence-within-each-individ-in-sas/m-p/831513#M328604</link>
      <description>&lt;P&gt;Do the individuals have IDs? As I understand it, you want to reset the index to 1 whenever seqnr is 1. Which is that my code does.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Sep 2022 08:50:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Make-indicator-to-split-two-incidence-within-each-individ-in-sas/m-p/831513#M328604</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2022-09-02T08:50:47Z</dc:date>
    </item>
    <item>
      <title>Re: Make indicator to split two incidence within each individ in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Make-indicator-to-split-two-incidence-within-each-individ-in-sas/m-p/831514#M328605</link>
      <description>Yes, but my dataset have first id number that are for example like this&lt;BR /&gt;&lt;BR /&gt;ID, seqn&lt;BR /&gt;101, 1&lt;BR /&gt;101 ,2&lt;BR /&gt;101 ,3&lt;BR /&gt;101 ,1&lt;BR /&gt;101 ,2&lt;BR /&gt;102 ,1&lt;BR /&gt;102 ,2&lt;BR /&gt;102 ,3&lt;BR /&gt;102 ,4&lt;BR /&gt;102 ,1&lt;BR /&gt;102 ,2&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Then I need this that the index asign 1 for ID number 1 from seqn 1 to 3 and index = 2 for 1,2 within the same id number. And it will start again on the next id-number and do it on the same way. How can i reset the index to 1 in the beginning of each id number in sas?</description>
      <pubDate>Fri, 02 Sep 2022 08:56:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Make-indicator-to-split-two-incidence-within-each-individ-in-sas/m-p/831514#M328605</guid>
      <dc:creator>user40</dc:creator>
      <dc:date>2022-09-02T08:56:16Z</dc:date>
    </item>
    <item>
      <title>Re: Make indicator to split two incidence within each individ in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Make-indicator-to-split-two-incidence-within-each-individ-in-sas/m-p/831518#M328607</link>
      <description>&lt;P&gt;Like this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input ID seqn;
datalines;
101 1
101 2
101 3
101 1
101 2
102 1
102 2
102 3
102 4
102 1
102 2
;

data want;
   set have;
   by ID;
   if first.ID then index = 0;
   if seqn = 1 then index + 1;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Sep 2022 09:00:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Make-indicator-to-split-two-incidence-within-each-individ-in-sas/m-p/831518#M328607</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2022-09-02T09:00:59Z</dc:date>
    </item>
    <item>
      <title>Re: Make indicator to split two incidence within each individ in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Make-indicator-to-split-two-incidence-within-each-individ-in-sas/m-p/831519#M328608</link>
      <description>I only got index =1 in when seqn is 1 for this solution. I need also that index =1 for all 101 when seqn go from 1-3 , and index =2 when 1-2 in the next sequence in the same id number if you understand.</description>
      <pubDate>Fri, 02 Sep 2022 09:05:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Make-indicator-to-split-two-incidence-within-each-individ-in-sas/m-p/831519#M328608</guid>
      <dc:creator>user40</dc:creator>
      <dc:date>2022-09-02T09:05:37Z</dc:date>
    </item>
    <item>
      <title>Re: Make indicator to split two incidence within each individ in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Make-indicator-to-split-two-incidence-within-each-individ-in-sas/m-p/831523#M328610</link>
      <description>&lt;P&gt;I do understand.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here are my results from the code above. I think that is what you describe?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;ID   seqn  index
101  1     1
101  2     1
101  3     1
101  1     2
101  2     2
102  1     1
102  2     1
102  3     1
102  4     1
102  1     2
102  2     2&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Sep 2022 10:30:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Make-indicator-to-split-two-incidence-within-each-individ-in-sas/m-p/831523#M328610</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2022-09-02T10:30:16Z</dc:date>
    </item>
  </channel>
</rss>

