<?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: Continuous enrollment gap by multiple categories in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Continuous-enrollment-gap-by-multiple-categories/m-p/672735#M202213</link>
    <description>&lt;OL&gt;
&lt;LI&gt;What does 12/31/9999 mean?&amp;nbsp; Does start=01APR2018 with end=31DEC999 mean that time span overlaps with all date ranges after 01APR2018?&amp;nbsp; This would mean there can no gaps in that range.&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;Which brings me to this question.&amp;nbsp; What is a gap?&amp;nbsp; The only way I can see the 30 day gap for PATID 1 that you mention is if I limit the consideration to records with PLAN=1.&lt;BR /&gt;&lt;BR /&gt;But if I apply the same rule to PATID 2 (looking for gaps with a given PLAN for PATID 2) I don't see the multiple 45 day gaps you cite.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;Which in turn makes me ask whether you intend to ignore records with PLAN=.&lt;/LI&gt;
&lt;/OL&gt;</description>
    <pubDate>Tue, 28 Jul 2020 05:23:09 GMT</pubDate>
    <dc:creator>mkeintz</dc:creator>
    <dc:date>2020-07-28T05:23:09Z</dc:date>
    <item>
      <title>Continuous enrollment gap by multiple categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Continuous-enrollment-gap-by-multiple-categories/m-p/672680#M202187</link>
      <description>&lt;P&gt;Hi all,&lt;BR /&gt;&lt;BR /&gt;I've seen other threads in the SAS programming community that address the issue of continuous enrollment with various lags. I wanted to present a more complex request involving additional variables aside from date.&lt;BR /&gt;&lt;BR /&gt;I have a subset example of a sample dataset as follows:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data History;
input patid plan lob $ aid $ eligible start end;
informat start end mmddyy10.;
format start end date9.;
cards;
1 1 MC LIS 1 10/1/2019 12/31/9999
1 2 MC LIS 1 9/1/2019 9/30/2019
1 1 MC LIS 1 10/1/2018 08/31/2019
1 . FFS LIS 1 4/1/2018 12/31/9999
1 1 MC LIS 1 4/1/2018 9/30/2018
1 . FFS noLIS 0 8/1/2015 3/31/2018
1 1 MC noLIS 0 8/1/2015 3/31/2018
2 . FFS LIS 1 12/18/2019 12/31/9999
2 3 MC LIS 1 6/1/2019 12/17/2019
2 . FFS LIS 1 5/1/2019 12/31/9999
2 3 MC LIS 1 8/1/2018 4/30/2019
2 3 MC LIS 1 7/1/2018 7/31/2018
2 . FFS LIS 1 5/1/2018 4/30/2019
3 2 MC noLIS 0 8/1/2018 12/31/9999
3 2 MC noLIS 0 8/1/2017 7/31/2018
3 . FFS noLIS 0 5/1/2017 12/31/9999
3 . FFS noLIS 0 12/1/2012 4/30/2017
3 2 MC noLIS 0 12/1/2012 4/30/2017
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;This dataset has:&lt;BR /&gt;1) patient id&lt;BR /&gt;2) Plan&lt;BR /&gt;3) Line of Business (e.g. Medicare FFS or Managed Care (MC)&lt;BR /&gt;4) Aid (LIS vs. noLIS)&lt;BR /&gt;5) Eligibility Criteria&lt;BR /&gt;6) Start Date&lt;BR /&gt;7) End Date&lt;BR /&gt;&lt;BR /&gt;Want:&lt;BR /&gt;&lt;BR /&gt;I want to create 2 datasets; continuously enrolled for the calendar year with no more than 1 gap of 45 days&lt;BR /&gt;&lt;BR /&gt;By aid (LIS)--like a case vs control with the aid category being the identifier&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Results:&lt;BR /&gt;Patient 1: Would fall into the case group; has only 1 gap of 30 days so it is included&lt;BR /&gt;Patient 2: Would be removed since they have 2 gaps in enrollment&lt;BR /&gt;Patient 3: Would fall into the control group; no gap and has noLIS&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jul 2020 16:37:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Continuous-enrollment-gap-by-multiple-categories/m-p/672680#M202187</guid>
      <dc:creator>A_Swoosh</dc:creator>
      <dc:date>2020-07-28T16:37:10Z</dc:date>
    </item>
    <item>
      <title>Re: Continuous enrollment gap by multiple categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Continuous-enrollment-gap-by-multiple-categories/m-p/672735#M202213</link>
      <description>&lt;OL&gt;
&lt;LI&gt;What does 12/31/9999 mean?&amp;nbsp; Does start=01APR2018 with end=31DEC999 mean that time span overlaps with all date ranges after 01APR2018?&amp;nbsp; This would mean there can no gaps in that range.&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;Which brings me to this question.&amp;nbsp; What is a gap?&amp;nbsp; The only way I can see the 30 day gap for PATID 1 that you mention is if I limit the consideration to records with PLAN=1.&lt;BR /&gt;&lt;BR /&gt;But if I apply the same rule to PATID 2 (looking for gaps with a given PLAN for PATID 2) I don't see the multiple 45 day gaps you cite.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;Which in turn makes me ask whether you intend to ignore records with PLAN=.&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Tue, 28 Jul 2020 05:23:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Continuous-enrollment-gap-by-multiple-categories/m-p/672735#M202213</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2020-07-28T05:23:09Z</dc:date>
    </item>
    <item>
      <title>Re: Continuous enrollment gap by multiple categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Continuous-enrollment-gap-by-multiple-categories/m-p/672736#M202214</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31461"&gt;@mkeintz&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. 9999 end date means it’s current and basically has no gaps. It extends beyond the measurement year.&lt;BR /&gt;&lt;BR /&gt;2. A gap is continuously enrolled for the entire calendar year with no more than 1 gap of 45 days.&lt;BR /&gt;&lt;BR /&gt;Edit: I corrected the instance for patient 2. They have 2 gaps; one from May to June and another from 12/17-12/31&lt;BR /&gt;&lt;BR /&gt;3. Plan is only needed for this instance; The plan they begin the measurement year with (2019). Any breaks of more than 45 days (eg row 2 for patient 1) would be considered a gap. So for patient 1, they would be in the case group because their aid is LIS, they are eligible and they have 1 gap (row 2 equaling less than 45 days).&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jul 2020 23:06:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Continuous-enrollment-gap-by-multiple-categories/m-p/672736#M202214</guid>
      <dc:creator>A_Swoosh</dc:creator>
      <dc:date>2020-07-29T23:06:31Z</dc:date>
    </item>
    <item>
      <title>Re: Continuous enrollment gap by multiple categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Continuous-enrollment-gap-by-multiple-categories/m-p/673011#M202363</link>
      <description>&lt;P&gt;I'm not sure if I'm on the right track but this is what I have so far:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let mstart  = 01JAN;
%let mend    = 31DEC;
%let ystart  = 2019;
%let yend    = 2019;

proc sort data = history out = cases (keep = patid LOB aid PLAN StartDate EndDate eligible);
			by patid StartDate EndDate;
			where EndDate &amp;gt; "&amp;amp;mstart.&amp;amp;ystart."d and StartDate &amp;lt; "&amp;amp;mend.&amp;amp;yend."d and LOB = "MC" and (intnx('year',DOB,18,'same')) &amp;gt; "&amp;amp;mstart.&amp;amp;ystart."d and eligible=1
run;

		data cases_test;
			retain gap_count last_start service_end service_began official_start official_end;
			set cases;
			by patid;
			format last_start service_end service_began official_start official_end date9.;


			if first.patidthen do;
				if StartDate &amp;gt;= "&amp;amp;mstart.&amp;amp;ystart."d then service_began = StartDate;
				else service_began = "&amp;amp;mstart.&amp;amp;ystart."d;
				if EndDate &amp;lt;= "&amp;amp;mend.&amp;amp;yend."d then service_end = EndDate;
				else service_end = "&amp;amp;mend.&amp;amp;yend."d;
				if StartDate &amp;gt;= "&amp;amp;mstart.&amp;amp;ystart."d then last_start=StartDate;
				else last_start = "&amp;amp;mstart.&amp;amp;ystart."d;
				gap_count=0;
			end;
			else do;
				if StartDate &amp;lt; service_began then do;
					if StartDate &amp;gt;= "&amp;amp;mstart.&amp;amp;ystart."d then service_began = StartDate;
					else service_began = "&amp;amp;mstart.&amp;amp;ystart."d;
				end;
				else service_began = service_began;
				if EndDate &amp;gt; service_end then do;
					if EndDate &amp;lt;= "&amp;amp;mend.&amp;amp;yend."d then service_end = EndDate;
					else service_end = "&amp;amp;mend.&amp;amp;yend."d;
				end;
				else service_end=service_end;
				if intck('day',EndDate,last_start) &amp;gt; 0 then gap_count=gap_count+(intck('day',EndDate,last_start)-1); 
				else gap_count=gap_count;
				if StartDate &amp;gt;= "&amp;amp;mstart.&amp;amp;ystart."d then last_start=StartDate;
				else last_start = "&amp;amp;mstart.&amp;amp;ystart."d;
			end;

			official_start="&amp;amp;mstart.&amp;amp;ystart."d;
			official_end="&amp;amp;mend.&amp;amp;yend."d;
run;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I think from here I may be able to use a lag from the previous row then create gap variables to count the different gaps. Not sure if there is a better approach...&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jul 2020 23:05:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Continuous-enrollment-gap-by-multiple-categories/m-p/673011#M202363</guid>
      <dc:creator>A_Swoosh</dc:creator>
      <dc:date>2020-07-29T23:05:58Z</dc:date>
    </item>
  </channel>
</rss>

