<?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 continuous enrollment with gap in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/continuous-enrollment-with-gap/m-p/511840#M137760</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input id$2. start  end ;
attrib start format =date9. informat=date9.;
attrib end format =date9. informat=date9.;
datalines;
1 01JAN2015 14FEB2015
1 18FEB2015 30APR2015
1 05MAY2015 30AUG2015
2 01jan2015 28feb2015
2 01apr2015 30apr2015
3 01JAN2015 14FEB2015
3 15FEB2015 15MAR2015
3 20MAR2015 30APR2015
4 01JAN2015 31JAN2015
4 01JAN2015 15APR2015
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I want to create a database with continuous enrollment allowing a gap of 7 days between the end of one period and the start of the next one. I want to keep one period per id reflecting only the first period&amp;nbsp;&lt;/P&gt;&lt;P&gt;Output&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;1 01JAN2015  30AUG2015
2 01jan2015 28feb2015
3 15FEB2015 30APR2015
4 01JAN2015 15APR2015&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 09 Nov 2018 23:00:02 GMT</pubDate>
    <dc:creator>lillymaginta</dc:creator>
    <dc:date>2018-11-09T23:00:02Z</dc:date>
    <item>
      <title>continuous enrollment with gap</title>
      <link>https://communities.sas.com/t5/SAS-Programming/continuous-enrollment-with-gap/m-p/511840#M137760</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input id$2. start  end ;
attrib start format =date9. informat=date9.;
attrib end format =date9. informat=date9.;
datalines;
1 01JAN2015 14FEB2015
1 18FEB2015 30APR2015
1 05MAY2015 30AUG2015
2 01jan2015 28feb2015
2 01apr2015 30apr2015
3 01JAN2015 14FEB2015
3 15FEB2015 15MAR2015
3 20MAR2015 30APR2015
4 01JAN2015 31JAN2015
4 01JAN2015 15APR2015
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I want to create a database with continuous enrollment allowing a gap of 7 days between the end of one period and the start of the next one. I want to keep one period per id reflecting only the first period&amp;nbsp;&lt;/P&gt;&lt;P&gt;Output&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;1 01JAN2015  30AUG2015
2 01jan2015 28feb2015
3 15FEB2015 30APR2015
4 01JAN2015 15APR2015&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Nov 2018 23:00:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/continuous-enrollment-with-gap/m-p/511840#M137760</guid>
      <dc:creator>lillymaginta</dc:creator>
      <dc:date>2018-11-09T23:00:02Z</dc:date>
    </item>
    <item>
      <title>Re: continuous enrollment with gap</title>
      <link>https://communities.sas.com/t5/SAS-Programming/continuous-enrollment-with-gap/m-p/511851#M137762</link>
      <description>&lt;P&gt;You&lt;SPAN&gt; want to keep &lt;STRONG&gt;one period&lt;/STRONG&gt; per id reflecting only the first period&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Then what is this?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;SPAN class="token number"&gt;3&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;01&lt;/SPAN&gt;JAN2015 &lt;SPAN class="token number"&gt;14&lt;/SPAN&gt;FEB2015&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt; &lt;SPAN class="token number"&gt;3&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;15&lt;/SPAN&gt;FEB2015 &lt;SPAN class="token number"&gt;30&lt;/SPAN&gt;APR2015&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Nov 2018 21:55:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/continuous-enrollment-with-gap/m-p/511851#M137762</guid>
      <dc:creator>MarkWik</dc:creator>
      <dc:date>2018-11-09T21:55:53Z</dc:date>
    </item>
    <item>
      <title>Re: continuous enrollment with gap</title>
      <link>https://communities.sas.com/t5/SAS-Programming/continuous-enrollment-with-gap/m-p/511870#M137772</link>
      <description>&lt;P&gt;Sorry the error was corrected&lt;/P&gt;</description>
      <pubDate>Fri, 09 Nov 2018 23:00:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/continuous-enrollment-with-gap/m-p/511870#M137772</guid>
      <dc:creator>lillymaginta</dc:creator>
      <dc:date>2018-11-09T23:00:36Z</dc:date>
    </item>
    <item>
      <title>Re: continuous enrollment with gap</title>
      <link>https://communities.sas.com/t5/SAS-Programming/continuous-enrollment-with-gap/m-p/511872#M137774</link>
      <description>&lt;P&gt;Does you data ever include overlapping periods? Or nested periods?&amp;nbsp; If so that makes the problem a little harder.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Nov 2018 23:08:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/continuous-enrollment-with-gap/m-p/511872#M137774</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-11-09T23:08:01Z</dc:date>
    </item>
    <item>
      <title>Re: continuous enrollment with gap</title>
      <link>https://communities.sas.com/t5/SAS-Programming/continuous-enrollment-with-gap/m-p/511895#M137788</link>
      <description>&lt;P&gt;Yes, I do have overlapping or nested periods.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Nov 2018 01:32:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/continuous-enrollment-with-gap/m-p/511895#M137788</guid>
      <dc:creator>lillymaginta</dc:creator>
      <dc:date>2018-11-10T01:32:10Z</dc:date>
    </item>
    <item>
      <title>Re: continuous enrollment with gap</title>
      <link>https://communities.sas.com/t5/SAS-Programming/continuous-enrollment-with-gap/m-p/511919#M137801</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input id$2. start  end ;
attrib start format =date9. informat=date9.;
attrib end format =date9. informat=date9.;
datalines;
1 01JAN2015 14FEB2015
1 18FEB2015 30APR2015
1 05MAY2015 30AUG2015
2 01jan2015 28feb2015
2 01apr2015 30apr2015
3 01JAN2015 14FEB2015
3 15FEB2015 15MAR2015
3 20MAR2015 30APR2015
4 01JAN2015 31JAN2015
4 01JAN2015 15APR2015
;
run;
data temp;
 set test;
 by id;
 if start-lag(end)&amp;gt;7 or first.id then group+1;
run;
data temp;
 do until(last.group);
  set temp(rename=(start=_start));
  by id group;
  if first.group then start=_start;
 end;
 format start date9.;
drop _start group;
run;
data want;
 set temp;
 by id;
 if first.id;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 10 Nov 2018 11:19:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/continuous-enrollment-with-gap/m-p/511919#M137801</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-11-10T11:19:45Z</dc:date>
    </item>
    <item>
      <title>Re: continuous enrollment with gap</title>
      <link>https://communities.sas.com/t5/SAS-Programming/continuous-enrollment-with-gap/m-p/511926#M137804</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;, you are the best!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Nov 2018 13:53:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/continuous-enrollment-with-gap/m-p/511926#M137804</guid>
      <dc:creator>lillymaginta</dc:creator>
      <dc:date>2018-11-10T13:53:12Z</dc:date>
    </item>
  </channel>
</rss>

