<?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: coding using dates in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/coding-using-dates/m-p/896507#M354241</link>
    <description>&lt;P&gt;You should be able to use SUBSTR() to help.&lt;/P&gt;
&lt;P&gt;Say you had a string of length 24 representing the 24 months in 2022 and 2023 and you wanted to see if someone had 3 months of enrollment that included the month of an EVENT and the next two months.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
   input id event :date.  estring $24. ;
   format event date9.;
cards;
1 01MAR2022 011111000000000000000000
2 01MAR2022 111100000000000000000000
3 01DEC2023 111111111111111111111111
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So just calculate the index representing their event date and then take the string starting at the point and see it if starts with 3 ones to see if there is 3 months of coverage.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  index=1+intck('month','01JAN2022'd,event);
  if index in (1:24) then cover3 = ('111' = substrn(estring,index,3) ) ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The first case has 3 months coverage.&amp;nbsp; The second doesn't since it only has March and April.&amp;nbsp; The last one doesn't since we don't know about the coverage past Dec 2023.&lt;/P&gt;</description>
    <pubDate>Fri, 29 Sep 2023 18:24:43 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2023-09-29T18:24:43Z</dc:date>
    <item>
      <title>coding using dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/coding-using-dates/m-p/896372#M354180</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I have a dataset this way&lt;/P&gt;&lt;P&gt;ID. &amp;nbsp; date. &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;A1. &amp;nbsp;A2. &amp;nbsp; A3. A4. &amp;nbsp; &amp;nbsp;A5. &amp;nbsp; &amp;nbsp;A6. &amp;nbsp; &amp;nbsp;A7&lt;/P&gt;&lt;P&gt;1. &amp;nbsp; &amp;nbsp; &amp;nbsp;01-apr-23 &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;&lt;P&gt;2. &amp;nbsp; &amp;nbsp; &amp;nbsp;02-may-23 &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;&lt;P&gt;3 &amp;nbsp; &amp;nbsp; &amp;nbsp;10-jun-23 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp;0 &amp;nbsp; &amp;nbsp; &amp;nbsp;0 &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/P&gt;&lt;P&gt;4 &amp;nbsp; &amp;nbsp; &amp;nbsp;21 may-23 &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to identify IDs in this way&lt;/P&gt;&lt;P&gt;01-apr-23 to 30 apr-23 -- who have 1 in A1-A6&lt;/P&gt;&lt;P&gt;01-may-23 to 31-may-23 who have 1 in A2-A7&lt;/P&gt;&lt;P&gt;01-jun-23 to 30-jun-23 &amp;nbsp;who have 1 in a1-a4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to use do loop and proc transpose but failed to get the right code. need help please!&lt;/P&gt;&lt;P&gt;Thank you in advance&lt;/P&gt;&lt;P&gt;Appreciate it&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2023 05:55:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/coding-using-dates/m-p/896372#M354180</guid>
      <dc:creator>stellapersis7</dc:creator>
      <dc:date>2023-09-29T05:55:13Z</dc:date>
    </item>
    <item>
      <title>Re: coding using dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/coding-using-dates/m-p/896380#M354184</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;What does the wanted results look like?&lt;/P&gt;
&lt;P&gt;Do you want to have the records or the column names?&lt;/P&gt;
&lt;P&gt;Do you want the results from the date to end of the month or explicitly only to 30apr23, 31may23, 30jun23?&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2023 08:04:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/coding-using-dates/m-p/896380#M354184</guid>
      <dc:creator>Oligolas</dc:creator>
      <dc:date>2023-09-29T08:04:32Z</dc:date>
    </item>
    <item>
      <title>Re: coding using dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/coding-using-dates/m-p/896381#M354185</link>
      <description>&lt;P&gt;What is the rule for selecting the variables in which to look for the "1" values?&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2023 08:18:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/coding-using-dates/m-p/896381#M354185</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-09-29T08:18:11Z</dc:date>
    </item>
    <item>
      <title>Re: coding using dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/coding-using-dates/m-p/896387#M354188</link>
      <description>&lt;P&gt;Yeah, the rule is very confusing...&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Do I understand it correctly:&lt;/P&gt;&lt;P&gt;e.g. For dates between 01Apr2023 to 30Apr2023, you want to extract the ID of a row only if there is (at least one) 1 in A1-A6?&amp;nbsp;&lt;BR /&gt;or maybe is it&lt;BR /&gt;If there is at least one 1 in A1-A6, check if the date is in correct range&amp;nbsp;between 01Apr2023 to 30Apr2023?&lt;BR /&gt;&lt;BR /&gt;Anyway, make sure you're not working on strings as a date, use informat to read in dates to numeric representation.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2023 08:32:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/coding-using-dates/m-p/896387#M354188</guid>
      <dc:creator>Lukkul</dc:creator>
      <dc:date>2023-09-29T08:32:28Z</dc:date>
    </item>
    <item>
      <title>Re: coding using dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/coding-using-dates/m-p/896461#M354217</link>
      <description>&lt;P&gt;Sorry for the confusion!&lt;/P&gt;&lt;P&gt;So the &amp;nbsp;A1-A7 variables can be either 0 or 1&amp;nbsp;(its like yes/no)&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't necessarily need to make a new dataset with those observations but I need just counts&lt;/P&gt;&lt;P&gt;So my research question is:&lt;/P&gt;&lt;P&gt;How many of the IDs between &lt;SPAN&gt;01-apr-23 to 30 apr-23 have all 1 in A1-A6?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(the results be like 80 IDs out of the 100 IDs present between&amp;nbsp;01-apr-23 to 30 apr-23 have all 1s&amp;nbsp;in A1-A6)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;similarly&amp;nbsp;How many of the IDs between 01-may-23 to 31-may-23&amp;nbsp;have&amp;nbsp;all 1 in A2-A7?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;and&amp;nbsp;How many of the IDs between 01-jun-23 to 30-jun-23 have all 1 in a1-a4?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2023 15:27:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/coding-using-dates/m-p/896461#M354217</guid>
      <dc:creator>stellapersis7</dc:creator>
      <dc:date>2023-09-29T15:27:45Z</dc:date>
    </item>
    <item>
      <title>coding use of dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/coding-using-dates/m-p/896476#M354231</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I have a dataset this way&lt;/P&gt;&lt;P&gt;ID. &amp;nbsp; date. &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;A1. &amp;nbsp;A2. &amp;nbsp; A3. A4. &amp;nbsp; &amp;nbsp;A5. &amp;nbsp; &amp;nbsp;A6. &amp;nbsp; &amp;nbsp;A7&lt;/P&gt;&lt;P&gt;1. &amp;nbsp; &amp;nbsp; &amp;nbsp;01-apr-23 &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;&lt;P&gt;2. &amp;nbsp; &amp;nbsp; &amp;nbsp;02-may-23 &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;&lt;P&gt;3 &amp;nbsp; &amp;nbsp; &amp;nbsp;10-jun-23 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp;0 &amp;nbsp; &amp;nbsp; &amp;nbsp;0 &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/P&gt;&lt;P&gt;4 &amp;nbsp; &amp;nbsp; &amp;nbsp;21 may-23 &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;So the &amp;nbsp;A1-A7 variables can be either 0 or 1&amp;nbsp;(its like yes/no)&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't necessarily need to make a new dataset with those observations but I need just counts&lt;/P&gt;&lt;P&gt;So my research question is:&lt;/P&gt;&lt;P&gt;How many of the IDs between &lt;SPAN&gt;01-apr-23 to 30 apr-23 have all 1 in A1-A6?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(the results be like 80 IDs out of the 100 IDs present between&amp;nbsp;01-apr-23 to 30 apr-23 have all 1s&amp;nbsp;in A1-A6)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;similarly&amp;nbsp;How many of the IDs between 01-may-23 to 31-may-23&amp;nbsp;have&amp;nbsp;all 1 in A2-A7?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;and&amp;nbsp;How many of the IDs between 01-jun-23 to 30-jun-23 have all 1 in a1-a4?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I tried to use do loop and proc transpose but failed to get the right code. need help please!&lt;/P&gt;&lt;P&gt;Thank you in advance&lt;/P&gt;&lt;P&gt;Appreciate it&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2023 16:47:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/coding-using-dates/m-p/896476#M354231</guid>
      <dc:creator>stellapersis7</dc:creator>
      <dc:date>2023-09-29T16:47:23Z</dc:date>
    </item>
    <item>
      <title>Re: coding using dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/coding-using-dates/m-p/896478#M354226</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/435319"&gt;@stellapersis7&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Sorry for the confusion!&lt;/P&gt;
&lt;P&gt;So the &amp;nbsp;A1-A7 variables can be either 0 or 1&amp;nbsp;(its like yes/no)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't necessarily need to make a new dataset with those observations but I need just counts&lt;/P&gt;
&lt;P&gt;So my research question is:&lt;/P&gt;
&lt;P&gt;How many of the IDs between &lt;SPAN&gt;01-apr-23 to 30 apr-23 have all 1 in A1-A6?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;(the results be like 80 IDs out of the 100 IDs present between&amp;nbsp;01-apr-23 to 30 apr-23 have all 1s&amp;nbsp;in A1-A6)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;similarly&amp;nbsp;How many of the IDs between 01-may-23 to 31-may-23&amp;nbsp;have&amp;nbsp;all 1 in A2-A7?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;and&amp;nbsp;How many of the IDs between 01-jun-23 to 30-jun-23 have all 1 in a1-a4?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So how do you know that in April you have to question A1-A6, in May A2-A7, but in June A1-A4? Please explain the rule.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2023 16:53:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/coding-using-dates/m-p/896478#M354226</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-09-29T16:53:51Z</dc:date>
    </item>
    <item>
      <title>Re: coding using dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/coding-using-dates/m-p/896487#M354230</link>
      <description>&lt;P&gt;That's my research question,&lt;/P&gt;&lt;P&gt;A's stand for months (jan, feb etc)&lt;/P&gt;&lt;P&gt;So, for those born in April, 3 months prior and 3 months later is their eligibility to choose.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2023 17:24:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/coding-using-dates/m-p/896487#M354230</guid>
      <dc:creator>stellapersis7</dc:creator>
      <dc:date>2023-09-29T17:24:39Z</dc:date>
    </item>
    <item>
      <title>Re: coding using dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/coding-using-dates/m-p/896492#M354232</link>
      <description>&lt;P&gt;And from where do you get the birth dates? Your variable "date" can't be it, because someone born in June should not check January to April, according to your rule.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please do not force us to pull information out of your nose little bit by little bit. The quickest way to a solution is a proper question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And do not repost questions in new threads, it only forces one of use to merge the posts.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2023 17:36:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/coding-using-dates/m-p/896492#M354232</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-09-29T17:36:48Z</dc:date>
    </item>
    <item>
      <title>Re: coding using dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/coding-using-dates/m-p/896495#M354235</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/435319"&gt;@stellapersis7&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;That's my research question,&lt;/P&gt;
&lt;P&gt;A's stand for months (jan, feb etc)&lt;/P&gt;
&lt;P&gt;So, for those born in April, 3 months prior and 3 months later is their eligibility to choose.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Medicare enrollment?&amp;nbsp; That has a four month window if you count the month of birth.&amp;nbsp; It really has a 7 month enrollment window since you can enroll up to 3 months before your birthday.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2023 17:45:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/coding-using-dates/m-p/896495#M354235</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-09-29T17:45:24Z</dc:date>
    </item>
    <item>
      <title>Re: coding using dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/coding-using-dates/m-p/896499#M354238</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/435319"&gt;@stellapersis7&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;That's my research question,&lt;/P&gt;
&lt;P&gt;A's stand for months (jan, feb etc)&lt;/P&gt;
&lt;P&gt;So, for those born in April, 3 months prior and 3 months later is their eligibility to choose.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I don't think your proposed source data can answer that question.&amp;nbsp; Where are the dates?&amp;nbsp; What do the A variables actually mean?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You probably need actual dates.&amp;nbsp; So you need the date they are eligible to enroll.&amp;nbsp; If you have DOB you could calculate the enrollment window. So someone that was 65 in April 2023 could have enrolled in the 7 month window between 01JAN2023 and 31JUL2023.&amp;nbsp; Do you have the actual date they enrolled?&amp;nbsp; If so you can then test whether or not they enrolled, whether they enrolled in that window, whether they enrolled after that window, whether enrolled before that window (because of meeting some other qualification than just age).&lt;/P&gt;
&lt;P&gt;So if you have data like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input id dob :date. enroll :date.;
  format date enroll date9.;
cards;
1 01APR1958 01JAN2023
2 30JUL1958 01APR2023
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can test if they enrolled in the window.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  inwindow = . &amp;lt; abs(intck('month',intnx('year',dob,65),enroll)) &amp;lt;= 3 ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 29 Sep 2023 17:57:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/coding-using-dates/m-p/896499#M354238</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-09-29T17:57:36Z</dc:date>
    </item>
    <item>
      <title>Re: coding using dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/coding-using-dates/m-p/896505#M354239</link>
      <description>&lt;P&gt;It's not Medicare, but a local similar dataset of enrollments which I cannot disclose. I want to check the continuous enrollment of the individuals 3 months prior and later. The monthly enrollments are given as a table of A's with 1 and 0. I need the sas code to run through all the months and identify individuals who have continuous enrollment period of 3 months prior and 3 months later to the "date".&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2023 18:13:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/coding-using-dates/m-p/896505#M354239</guid>
      <dc:creator>stellapersis7</dc:creator>
      <dc:date>2023-09-29T18:13:48Z</dc:date>
    </item>
    <item>
      <title>Re: coding using dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/coding-using-dates/m-p/896506#M354240</link>
      <description>&lt;P&gt;needs be you can merge.&lt;/P&gt;
&lt;P&gt;thank you&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2023 18:14:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/coding-using-dates/m-p/896506#M354240</guid>
      <dc:creator>stellapersis7</dc:creator>
      <dc:date>2023-09-29T18:14:34Z</dc:date>
    </item>
    <item>
      <title>Re: coding using dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/coding-using-dates/m-p/896507#M354241</link>
      <description>&lt;P&gt;You should be able to use SUBSTR() to help.&lt;/P&gt;
&lt;P&gt;Say you had a string of length 24 representing the 24 months in 2022 and 2023 and you wanted to see if someone had 3 months of enrollment that included the month of an EVENT and the next two months.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
   input id event :date.  estring $24. ;
   format event date9.;
cards;
1 01MAR2022 011111000000000000000000
2 01MAR2022 111100000000000000000000
3 01DEC2023 111111111111111111111111
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So just calculate the index representing their event date and then take the string starting at the point and see it if starts with 3 ones to see if there is 3 months of coverage.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  index=1+intck('month','01JAN2022'd,event);
  if index in (1:24) then cover3 = ('111' = substrn(estring,index,3) ) ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The first case has 3 months coverage.&amp;nbsp; The second doesn't since it only has March and April.&amp;nbsp; The last one doesn't since we don't know about the coverage past Dec 2023.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2023 18:24:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/coding-using-dates/m-p/896507#M354241</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-09-29T18:24:43Z</dc:date>
    </item>
  </channel>
</rss>

