<?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 from service date to 30 days after the service date in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Continuous-enrollment-from-service-date-to-30-days-after-the/m-p/569796#M160608</link>
    <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a wide dataset like this:&lt;/P&gt;&lt;P&gt;All dates are in YYYY-MM-DD format.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt;input member_id $ service_date coverage_start1 coverage_end1 coverage_start2 coverage_end2;&lt;BR /&gt;cards;&lt;BR /&gt;1 20150125 20130101 20131231 20150101 20150226&lt;BR /&gt;2 20150225 20150101 20150226 20170101 20170131&lt;BR /&gt;3 20161001 20160901 20161131 20161101 20161102&lt;/P&gt;&lt;P&gt;4 20180101 20171215 20180115 20180116 20180331&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want only the members that have continuous enrollment from service date to 30 days after the service date&lt;/P&gt;&lt;P&gt;Expected output&lt;/P&gt;&lt;P&gt;1 20150125 20130101 20131231 20150101 20150226&lt;/P&gt;&lt;P&gt;3 20161001 20160901 20161131 20161101 20161102&lt;/P&gt;&lt;P&gt;4 20180101 20171215 20180115 20180116 20180331&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;TIA&lt;/P&gt;</description>
    <pubDate>Fri, 28 Jun 2019 13:48:30 GMT</pubDate>
    <dc:creator>skavyasindhu</dc:creator>
    <dc:date>2019-06-28T13:48:30Z</dc:date>
    <item>
      <title>Continuous enrollment from service date to 30 days after the service date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Continuous-enrollment-from-service-date-to-30-days-after-the/m-p/569796#M160608</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a wide dataset like this:&lt;/P&gt;&lt;P&gt;All dates are in YYYY-MM-DD format.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt;input member_id $ service_date coverage_start1 coverage_end1 coverage_start2 coverage_end2;&lt;BR /&gt;cards;&lt;BR /&gt;1 20150125 20130101 20131231 20150101 20150226&lt;BR /&gt;2 20150225 20150101 20150226 20170101 20170131&lt;BR /&gt;3 20161001 20160901 20161131 20161101 20161102&lt;/P&gt;&lt;P&gt;4 20180101 20171215 20180115 20180116 20180331&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want only the members that have continuous enrollment from service date to 30 days after the service date&lt;/P&gt;&lt;P&gt;Expected output&lt;/P&gt;&lt;P&gt;1 20150125 20130101 20131231 20150101 20150226&lt;/P&gt;&lt;P&gt;3 20161001 20160901 20161131 20161101 20161102&lt;/P&gt;&lt;P&gt;4 20180101 20171215 20180115 20180116 20180331&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;TIA&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2019 13:48:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Continuous-enrollment-from-service-date-to-30-days-after-the/m-p/569796#M160608</guid>
      <dc:creator>skavyasindhu</dc:creator>
      <dc:date>2019-06-28T13:48:30Z</dc:date>
    </item>
    <item>
      <title>Re: Continuous enrollment from service date to 30 days after the service date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Continuous-enrollment-from-service-date-to-30-days-after-the/m-p/569809#M160611</link>
      <description>&lt;P&gt;IMPORTANT CONCEPT:&amp;nbsp;You make your coding MUCH MUCH MUCH easier if you treat dates as valid SAS date (or datetime) values, instead of human readable but hard-to-use 20150125. You do this by using the informat YYMMDD8. in your INPUT statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input member_id $ (service_date coverage_start1 coverage_end1
    coverage_start2 coverage_end2) (:yymmdd8.) ;
cards;
1 20150125 20130101 20131231 20150101 20150226
2 20150225 20150101 20150226 20170101 20170131
3 20161001 20160901 20161131 20161101 20161102
4 20180101 20171215 20180115 20180116 20180331
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now to determine continuous coverage for 30 days beyond start, you need to compute 30 days beyond start. So the above code is modified as shown below. (As I said, once these are actual SAS date values, finding a date 30 days after a given date is a simple thing to do).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input member_id $ (service_date coverage_start1 coverage_end1 coverage_start2 coverage_end2) (:yymmdd8.) ;
service_date_plus_30=service_date + 30;
cards;
1 20150125 20130101 20131231 20150101 20150226
2 20150225 20150101 20150226 20170101 20170131
3 20161001 20160901 20161131 20161101 20161102
4 20180101 20171215 20180115 20180116 20180331
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now continuous coverage ... the logic is that you need to have start date between (coverage_start1 and converage_end1) and / or start date between (coverage_start2 and coverage_end2); similarly service_date_plus_30 must also meet these conditions; and lastly if service_date is between coverage_start1 and coverage_end1 and service_date_plus_30 is between coverage_start2 and coverage_end2 then there can be no gap between coverage_end1 and coverage_start2.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wrote it in words, but it should be very easy to take the words written in the previous paragraph and turn it into a SAS IF statement, so I leave that particular task up to you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2019 14:14:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Continuous-enrollment-from-service-date-to-30-days-after-the/m-p/569809#M160611</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-06-28T14:14:38Z</dc:date>
    </item>
  </channel>
</rss>

