<?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: Identifying first index that meets criteria in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Identifying-first-index-that-meets-criteria/m-p/841397#M332700</link>
    <description>Thank you!</description>
    <pubDate>Fri, 28 Oct 2022 22:57:16 GMT</pubDate>
    <dc:creator>bkq32</dc:creator>
    <dc:date>2022-10-28T22:57:16Z</dc:date>
    <item>
      <title>Identifying first index that meets criteria</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identifying-first-index-that-meets-criteria/m-p/841387#M332691</link>
      <description>&lt;P&gt;I have a dataset with indicators for if a given person was enrolled in a program at various months. I want to create a variable "full" that specifies the month that marks a person's first 3 continuous months of enrollment (i.e. I want to identify the first&amp;nbsp; set of "1 1 1 " values that occurs per row). Any suggestions?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
 input person $ month_01 month_02 month_03 month_04 month_05 month_06;
 cards;
A 1 1 1 1 1 1
B 1 0 1 1 1 1
C 0 0 1 1 1 1
D 0 0 0 0 0 1
E 1 1 0 1 1 1
;
run;


data want;
 input person $ month_01 month_02 month_03 month_04 month_05 month_06 full;
 cards;
A 1 1 1 1 1 1 3
B 1 0 1 1 1 1 5
C 0 0 1 1 1 1 5
D 0 0 0 0 0 1 .
E 1 1 0 1 1 1 6
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2022 21:29:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identifying-first-index-that-meets-criteria/m-p/841387#M332691</guid>
      <dc:creator>bkq32</dc:creator>
      <dc:date>2022-10-28T21:29:06Z</dc:date>
    </item>
    <item>
      <title>Re: Identifying first index that meets criteria</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identifying-first-index-that-meets-criteria/m-p/841396#M332699</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
 input person $ month_01 month_02 month_03 month_04 month_05 month_06;
 length m $6 p $3;
 m=cats(of month:);
 p='111';
 f=find(m,p);
 if f then full=f+length(p)-1;
 cards;
A 1 1 1 1 1 1
B 1 0 1 1 1 1
C 0 0 1 1 1 1
D 0 0 0 0 0 1
E 1 1 0 1 1 1
;
run;
proc print;
   run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 641px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/76734iDDD55EAF7EC6B16B/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2022 22:58:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identifying-first-index-that-meets-criteria/m-p/841396#M332699</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2022-10-28T22:58:13Z</dc:date>
    </item>
    <item>
      <title>Re: Identifying first index that meets criteria</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Identifying-first-index-that-meets-criteria/m-p/841397#M332700</link>
      <description>Thank you!</description>
      <pubDate>Fri, 28 Oct 2022 22:57:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Identifying-first-index-that-meets-criteria/m-p/841397#M332700</guid>
      <dc:creator>bkq32</dc:creator>
      <dc:date>2022-10-28T22:57:16Z</dc:date>
    </item>
  </channel>
</rss>

