<?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: Enrollment Flags for Multple Years in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Enrollment-Flags-for-Multple-Years/m-p/548185#M151994</link>
    <description>&lt;P&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12151"&gt;@Jagadishkatam&lt;/a&gt;. I'm sorry, just tried your solution on the entire dataset. There are two more issues. Here another sample dataset:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input id$2. effdate :$ enddate:$ ;
start=input(scan(effdate,2,'.'),best.);
startm=input(scan(effdate,1,'.'),best.);
end=input(scan(enddate,2,'.'),best.);
endm=input(scan(enddate,1,'.'),best.);
datalines;
1 01.1996 07.2000
1 08.2010 12.2012
1 12.2014 01.2017
2 12.2008 09.2013
2 07.2015 02.2018
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN style="background-color: transparent; color: #333333; cursor: text; display: inline; float: none; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 16.8px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;Issues:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: transparent; color: #333333; cursor: text; display: inline; float: none; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 16.8px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;1) The code isn't picking up full enrollment for the year if enrollment begins January.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; See observation #1 - flag1996 should equal 1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2) When the start or end dates have month 12, then the program doesn't work correctly.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; See observation #2 - flag2010 should be missing&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; Observation #3 - flags 2014 and 2017 should be missing&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; Observation #4 - flags 2008 and 2013 should be missing&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Everything works fine on observations (like obs #5) where start and/or end are not in month 12 and start not in month 1. Do you know how to solve this? Thank you so much!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 03 Apr 2019 12:48:12 GMT</pubDate>
    <dc:creator>eabc0351</dc:creator>
    <dc:date>2019-04-03T12:48:12Z</dc:date>
    <item>
      <title>Enrollment Flags for Multple Years</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Enrollment-Flags-for-Multple-Years/m-p/548077#M151950</link>
      <description>&lt;P&gt;Hello SAS Friends,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to create flags to identify if a person was continuously enrolled in a health plan. Each person has multiple beginning and end enrollment dates through the course of the 18 years of data. I would like to create 18 variables (0/1) with value=1 if the person was enrolled 11 of 12 months of that year. Here is a sample of the data:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input id$2. effdate  enddate ;
attrib start format =MMYYP. informat=MMYYP.;
attrib end format =MMYYP. informat=MMYYP.;
datalines;
1	09.1996	07.2000
1	10.2000	10.2010 &amp;nbsp; 
1	12.2014	12.2017 &amp;nbsp; &amp;nbsp; &amp;nbsp;
2	11.2012	12.2014 
2	02.2015	08.2017
3	02.2000	07.2014
3	08.2014	05.2018 
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And here is the output that I want:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PID &amp;nbsp; &amp;nbsp;&amp;nbsp; effdate &amp;nbsp; &amp;nbsp; enddate &amp;nbsp; &amp;nbsp; flag2000 &amp;nbsp; &amp;nbsp; flag2001 &amp;nbsp; &amp;nbsp; flag2002 …&amp;nbsp; flag2010… flag2014... flag2017&lt;BR /&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 09.1996 &amp;nbsp;&amp;nbsp; 07.2000 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;BR /&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 10.2000 &amp;nbsp;&amp;nbsp; 10.2010 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;BR /&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 12.2014 &amp;nbsp;&amp;nbsp; 12.2017 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;BR /&gt;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 11.2012 &amp;nbsp; &amp;nbsp; 12.2014 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;BR /&gt;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 02.2015 &amp;nbsp; &amp;nbsp; 08.2017 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;BR /&gt;3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 02.2000 &amp;nbsp; &amp;nbsp; 07.2014 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 0&lt;BR /&gt;3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 08.2014 &amp;nbsp; &amp;nbsp; 05.2018 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 1&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2019 01:42:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Enrollment-Flags-for-Multple-Years/m-p/548077#M151950</guid>
      <dc:creator>eabc0351</dc:creator>
      <dc:date>2019-04-03T01:42:44Z</dc:date>
    </item>
    <item>
      <title>Re: Enrollment Flags for Multple Years</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Enrollment-Flags-for-Multple-Years/m-p/548085#M151955</link>
      <description>&lt;P&gt;Edit your post as a self-contained, syntactically correct data step using datalines, then perhaps I'll try harder.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm kind of over (the MANY) cut-and-paste posts, where I'm meant to convert the post into a working SAS data step.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And put your code in a SAS code block (the little "running man") so I can scroll the code rather than having it wrap.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2019 00:58:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Enrollment-Flags-for-Multple-Years/m-p/548085#M151955</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2019-04-03T00:58:21Z</dc:date>
    </item>
    <item>
      <title>Re: Enrollment Flags for Multple Years</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Enrollment-Flags-for-Multple-Years/m-p/548087#M151956</link>
      <description>&lt;P&gt;sorry &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15043"&gt;@ScottBass&lt;/a&gt;,&amp;nbsp;I've always hand-typed it in. Working on it now...&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2019 01:03:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Enrollment-Flags-for-Multple-Years/m-p/548087#M151956</guid>
      <dc:creator>eabc0351</dc:creator>
      <dc:date>2019-04-03T01:03:21Z</dc:date>
    </item>
    <item>
      <title>Re: Enrollment Flags for Multple Years</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Enrollment-Flags-for-Multple-Years/m-p/548091#M151959</link>
      <description>&lt;P&gt;While I stand by my message in my first post...I really do wish folks would post a self-contained data step so I don't have to do the conversion...perhaps I could have been less "terse" in my tone.&amp;nbsp; So sorry bout that &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyway, perhaps this will get you going.&amp;nbsp; And notice I didn't attempt to convert your data into a working data step &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's not complete, and you'll need to fiddle with it.&amp;nbsp; But I think the heavy lifting is there?&amp;nbsp; You'll also need to test it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
   id=1;
   start="01APR2012"d;
   end="01SEP2018"d;
   format start end yymmddd10.;
run;

data want;
   set have;
   by id start;
   length flag2000-flag2020 8;
   array flags{2000:2020} flag:;
   if first.id then do;
      do i=lbound(flags) to hbound(flags);
         flags{i}=0;
      end;
      counter=0;
   end;
   date=start;
   do until (date &amp;gt; end);
      if month(date)=1 then counter=0;
      counter+1;
      if month(date)=12 then flags{year(date)}=(counter ge 11);
      date=intnx('month',date,1);
   end;
   * drop i counter date;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In summary:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Use an array to process your flag variables&lt;/LI&gt;&lt;LI&gt;Use an explicit array index corresponding with the min and max year range of your data.&amp;nbsp; See&amp;nbsp;&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000201956.htm" target="_blank" rel="noopener"&gt;http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000201956.htm&lt;/A&gt;, search on lower: and :upper&lt;/LI&gt;&lt;LI&gt;Use the LBOUND and HBOUND functions to iterate over the bounds of your array&lt;/LI&gt;&lt;LI&gt;Use the YEAR function on your date as the index into your array (and thus your flag variables)&lt;/LI&gt;&lt;LI&gt;Use the INTNX function to iterate by month over the range of your start and end dates&lt;/LI&gt;&lt;LI&gt;Increment a counter to count months within the loop&lt;/LI&gt;&lt;LI&gt;Reset the counter when month=1, set your flag variable when month=12&lt;/LI&gt;&lt;LI&gt;You may not need the check on first.id?&amp;nbsp; But reset your flags to 0 for each new record (instead of the default missing value)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2019 03:01:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Enrollment-Flags-for-Multple-Years/m-p/548091#M151959</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2019-04-03T03:01:20Z</dc:date>
    </item>
    <item>
      <title>Re: Enrollment Flags for Multple Years</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Enrollment-Flags-for-Multple-Years/m-p/548146#M151975</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15043"&gt;@ScottBass&lt;/a&gt;.&amp;nbsp;Thank you for this solution. When I run the command, there is an error message that says:&amp;nbsp;ERROR: Array subscript out of range at line 196 column 30. The line and column numbers keep changing when I rerun the command. For example,&amp;nbsp;ERROR: Array subscript out of range at line 216 column 30. The flags and the other three variables --&amp;nbsp; i counter date -- are all in the output dataset, but there are no observations.&lt;/P&gt;&lt;P&gt;Could the issue be that my date is month/year (since day is not in the data)?&lt;/P&gt;&lt;P&gt;Thank you for your assistance!&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2019 09:48:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Enrollment-Flags-for-Multple-Years/m-p/548146#M151975</guid>
      <dc:creator>eabc0351</dc:creator>
      <dc:date>2019-04-03T09:48:32Z</dc:date>
    </item>
    <item>
      <title>Re: Enrollment Flags for Multple Years</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Enrollment-Flags-for-Multple-Years/m-p/548156#M151979</link>
      <description>&lt;P&gt;Please try&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input id$2. effdate :$ enddate:$ ;
start=input(scan(effdate,2,'.'),best.);
end=input(scan(enddate,2,'.'),best.);
datalines;
1 09.1996 07.2000
1 10.2000 10.2010   
1 12.2014 12.2017      
2 11.2012 12.2014 
2 02.2015 08.2017
3 02.2000 07.2014
3 08.2014 05.2018 
;
run;


proc sql;
select min(start), max(end) into: min , : max from test;
quit;

data want;
set test;
array yrs(*) flag1996 flag1997 flag1998 flag1999 flag2000 flag2001 flag2002 flag2003 flag2004 flag2005 flag2006 flag2007 flag2008 flag2009 flag2011 flag2012 flag2013 flag2014 flag2015 flag2016 flag2017 flag2018;
array yrss(22) _temporary_ (1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2011 2012 2013 2014 2015 2016 2017 2018);
do i = 1 to dim(yrs);
if start&amp;lt;yrss(i)&amp;lt;end then yrs(i)=1;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 03 Apr 2019 10:33:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Enrollment-Flags-for-Multple-Years/m-p/548156#M151979</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2019-04-03T10:33:59Z</dc:date>
    </item>
    <item>
      <title>Re: Enrollment Flags for Multple Years</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Enrollment-Flags-for-Multple-Years/m-p/548159#M151981</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12151"&gt;@Jagadishkatam&lt;/a&gt; . This worked except for observations #3 and #4:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #800000; font-family: Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 16.8px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-shadow: 0px 1px white; text-transform: none; -webkit-text-stroke-width: 0px; white-space: pre; word-spacing: 0px;"&gt;1 12.2014 12.2017&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;2 11.2012 12.2014 &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #333333; cursor: text; font-family: 'HelevticaNeue-light','Helvetica Neue',Helvetica,Arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;For these observations, flag2017 (for obs #3) and flag2014 (for obs #4) are missing, not 1. It's not registering enddate of month 12 as complete enrollment for that year. Any suggestions?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #333333; cursor: text; font-family: 'HelevticaNeue-light','Helvetica Neue',Helvetica,Arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2019 10:59:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Enrollment-Flags-for-Multple-Years/m-p/548159#M151981</guid>
      <dc:creator>eabc0351</dc:creator>
      <dc:date>2019-04-03T10:59:30Z</dc:date>
    </item>
    <item>
      <title>Re: Enrollment Flags for Multple Years</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Enrollment-Flags-for-Multple-Years/m-p/548168#M151986</link>
      <description>&lt;P&gt;Please try&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input id$2. effdate :$ enddate:$ ;
start=input(scan(effdate,2,'.'),best.);
startm=input(scan(effdate,1,'.'),best.);
end=input(scan(enddate,2,'.'),best.);
endm=input(scan(enddate,1,'.'),best.);
datalines;
1 09.1996 07.2000
1 10.2000 10.2010   
1 12.2014 12.2017      
2 11.2012 12.2014 
2 02.2015 08.2017
3 02.2000 07.2014
3 08.2014 05.2018 
;
run;


proc sql;
select min(start), max(end) into: min , : max from test;
quit;

data want;
set test;
array yrs(*) flag1996 flag1997 flag1998 flag1999 flag2000 flag2001 flag2002 flag2003 flag2004 flag2005 flag2006 flag2007 flag2008 flag2009 flag2011 flag2012 flag2013 flag2014 flag2015 flag2016 flag2017 flag2018;
array yrss(22) _temporary_ (1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2011 2012 2013 2014 2015 2016 2017 2018);
do i = 1 to dim(yrs);
if start&amp;lt;=yrss(i)&amp;lt;=end and (startm&amp;gt;=12 or endm&amp;gt;=12) then yrs(i)=1;
else if start&amp;lt;yrss(i)&amp;lt;end and (startm&amp;lt;12 or endm&amp;lt;12) then yrs(i)=1;
end;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 03 Apr 2019 11:31:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Enrollment-Flags-for-Multple-Years/m-p/548168#M151986</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2019-04-03T11:31:43Z</dc:date>
    </item>
    <item>
      <title>Re: Enrollment Flags for Multple Years</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Enrollment-Flags-for-Multple-Years/m-p/548185#M151994</link>
      <description>&lt;P&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12151"&gt;@Jagadishkatam&lt;/a&gt;. I'm sorry, just tried your solution on the entire dataset. There are two more issues. Here another sample dataset:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input id$2. effdate :$ enddate:$ ;
start=input(scan(effdate,2,'.'),best.);
startm=input(scan(effdate,1,'.'),best.);
end=input(scan(enddate,2,'.'),best.);
endm=input(scan(enddate,1,'.'),best.);
datalines;
1 01.1996 07.2000
1 08.2010 12.2012
1 12.2014 01.2017
2 12.2008 09.2013
2 07.2015 02.2018
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN style="background-color: transparent; color: #333333; cursor: text; display: inline; float: none; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 16.8px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;Issues:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: transparent; color: #333333; cursor: text; display: inline; float: none; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: 16.8px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;1) The code isn't picking up full enrollment for the year if enrollment begins January.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; See observation #1 - flag1996 should equal 1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2) When the start or end dates have month 12, then the program doesn't work correctly.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; See observation #2 - flag2010 should be missing&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; Observation #3 - flags 2014 and 2017 should be missing&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; Observation #4 - flags 2008 and 2013 should be missing&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Everything works fine on observations (like obs #5) where start and/or end are not in month 12 and start not in month 1. Do you know how to solve this? Thank you so much!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2019 12:48:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Enrollment-Flags-for-Multple-Years/m-p/548185#M151994</guid>
      <dc:creator>eabc0351</dc:creator>
      <dc:date>2019-04-03T12:48:12Z</dc:date>
    </item>
    <item>
      <title>Re: Enrollment Flags for Multple Years</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Enrollment-Flags-for-Multple-Years/m-p/548196#M152001</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input id $ effdate $  enddate $ ;
start=input(cats('01.',effdate),ddmmyy10.);
end=input(cats('01.',enddate),ddmmyy10.);
format start end ddmmyyp10.;
datalines;
1	09.1996	07.2000
1	10.2000	10.2010   
1	12.2014	12.2017      
2	11.2012	12.2014 
2	02.2015	08.2017
3	02.2000	07.2014
3	08.2014	05.2018 
;
run;
data temp;
 set test; 
 do i=0 to intck('month',start,end);
  date=intnx('month',start,i);output;
 end;
 format date ddmmyyp10.;
 drop i start end;
run;
proc freq data=temp noprint;
table id*effdate*enddate*date/out=temp1;
format date year4.;
run;
data temp2;
 set temp1;
 flag=(count&amp;gt;10);
 drop percent;
run;
proc transpose data=temp2 out=temp3 prefix=flag;
by  id effdate enddate;
var flag;
id date;
run;
proc stdize data=temp3 out=want missing=0 reponly;
var _numeric_;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 03 Apr 2019 13:22:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Enrollment-Flags-for-Multple-Years/m-p/548196#M152001</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-04-03T13:22:35Z</dc:date>
    </item>
    <item>
      <title>Re: Enrollment Flags for Multple Years</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Enrollment-Flags-for-Multple-Years/m-p/548308#M152033</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; and all!&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2019 19:07:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Enrollment-Flags-for-Multple-Years/m-p/548308#M152033</guid>
      <dc:creator>eabc0351</dc:creator>
      <dc:date>2019-04-03T19:07:42Z</dc:date>
    </item>
    <item>
      <title>Re: Enrollment Flags for Multple Years</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Enrollment-Flags-for-Multple-Years/m-p/549464#M152466</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;Could the issue be that my date is month/year (since day is not in the data)?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;You don't have a date, you have a character string.&amp;nbsp; Yes, you'll need to convert your character string to a SAS date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Apr 2019 03:34:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Enrollment-Flags-for-Multple-Years/m-p/549464#M152466</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2019-04-09T03:34:40Z</dc:date>
    </item>
  </channel>
</rss>

