<?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: Manipulating overlapping date claims and shifting them forward in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Manipulating-overlapping-date-claims-and-shifting-them-forward/m-p/486178#M126451</link>
    <description>What I have&lt;BR /&gt;person_id rx_start rx_end&lt;BR /&gt;1801 5/28/2014 6/27/2014&lt;BR /&gt;1801 6/28/2014 7/28/2014&lt;BR /&gt;1801 7/26/2014 8/25/2014&lt;BR /&gt;1801 8/24/2014 9/23/2014&lt;BR /&gt;1801 9/21/2014 10/21/2014&lt;BR /&gt;1801 10/25/2014 11/24/2014&lt;BR /&gt;1801 11/22/2014 12/22/2014&lt;BR /&gt;1801 12/20/2014 1/19/2015&lt;BR /&gt;2001 10/6/2014 11/5/2014&lt;BR /&gt;2001 11/4/2014 12/4/2014&lt;BR /&gt;2001 12/2/2014 1/1/2015&lt;BR /&gt;2001 12/30/2014 1/29/2015&lt;BR /&gt;what I want&lt;BR /&gt;person_id rx_start rx_end days_overlap rx_start_new rx_end_new&lt;BR /&gt;1801 5/28/2014 6/27/2014 0 5/28/2014 6/27/2014&lt;BR /&gt;1801 6/28/2014 7/28/2014 0 6/28/2014 7/28/2014&lt;BR /&gt;1801 7/26/2014 8/25/2014 2 7/28/2014 8/26/2014&lt;BR /&gt;1801 8/24/2014 9/23/2014 2 8/26/2014 9/25/2014&lt;BR /&gt;1801 9/21/2014 10/21/2014 4 9/25/2014 10/25/2014&lt;BR /&gt;1801 10/25/2014 11/24/2014 0 10/25/2014 11/24/2014&lt;BR /&gt;1801 11/22/2014 12/22/2014 2 11/24/2014 12/24/2014&lt;BR /&gt;1801 12/20/2014 1/19/2015 4 12/24/2014 1/23/2014&lt;BR /&gt;2001 10/6/2014 11/5/2014 0 10/6/2014 11/5/2014&lt;BR /&gt;2001 11/4/2014 12/4/2014 1 11/5/2014 12/5/2014&lt;BR /&gt;2001 12/2/2014 1/1/2015 3 12/5/2014 1/4/2015&lt;BR /&gt;2001 12/30/2014 1/29/2015 5 1/4/2015 2/3/2015&lt;BR /&gt;Any thoughts on how I can achieve this?&lt;BR /&gt;</description>
    <pubDate>Sun, 12 Aug 2018 18:08:22 GMT</pubDate>
    <dc:creator>tntmph0</dc:creator>
    <dc:date>2018-08-12T18:08:22Z</dc:date>
    <item>
      <title>Manipulating overlapping date claims and shifting them forward</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Manipulating-overlapping-date-claims-and-shifting-them-forward/m-p/485962#M126334</link>
      <description>&lt;P&gt;Hi SAS Community,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I could really use your help!&amp;nbsp;&lt;SPAN&gt;I have overlapping dates that I want to stretch out continuously.&amp;nbsp; Suppose I have the following claims:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;rx_start&lt;/TD&gt;&lt;TD&gt;rx_end&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5/28/2014&lt;/TD&gt;&lt;TD&gt;6/27/2014&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;6/28/2014&lt;/TD&gt;&lt;TD&gt;7/28/2014&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;7/26/2014&lt;/TD&gt;&lt;TD&gt;8/25/2014&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;8/24/2014&lt;/TD&gt;&lt;TD&gt;9/23/2014&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9/21/2014&lt;/TD&gt;&lt;TD&gt;10/21/2014&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;10/25/2014&lt;/TD&gt;&lt;TD&gt;11/24/2014&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;11/22/2014&lt;/TD&gt;&lt;TD&gt;12/22/2014&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;12/20/2014&lt;/TD&gt;&lt;TD&gt;1/19/2015&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to create a new column of rx start/end dates that doesn't overlap.&amp;nbsp; The first obs doesn't overlap with a prior.&amp;nbsp; Thus, the new column of rx start/end would have the same values.&amp;nbsp; The second obs doesn't overlap with the first; thus, the new column of rx start/end would have the same value as well.&amp;nbsp; The third row overlaps with the prior by two days.&amp;nbsp; So, the new column of rx start/end would shift forward to 7/28/2014 - 8/27/2014.&amp;nbsp; The fourth row overlaps with the NEW rx start/end dates of the prior row (row 3)&amp;nbsp; by 3 days.&amp;nbsp; So, it's new rx start/end date is 8/27/2014 - 9/26/2014.&amp;nbsp; The 5th row overlaps with the 4th row's new dates of&amp;nbsp;&lt;SPAN&gt;8/27/2014 - 9/26/2014 by 5 days.&amp;nbsp; So, it should shift forward to 9/26/2014 to 10/26/2016.&amp;nbsp; And, so forth and so forth.&amp;nbsp; My current versions of code are:&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;temp6;&lt;/P&gt;&lt;P&gt;set&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;temp5;&lt;/P&gt;&lt;P&gt;by&amp;nbsp; person_id class_category molecule strength rx_start rx_end;&lt;/P&gt;&lt;P&gt;retain&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;days_overlap rx_start_new rx_end_new;&lt;/P&gt;&lt;P&gt;rx_start_new=&lt;STRONG&gt;.&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;rx_end_new=&lt;STRONG&gt;.&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;days_overlap=&lt;STRONG&gt;.&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;format&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;rx_start_new rx_end_new&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;mmddyy10.;&lt;/P&gt;&lt;P&gt;if&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;first.person_id&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;then&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; days_overlap=&lt;STRONG&gt;0&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rx_start_new=datepart(rx_start);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rx_end_new=datepart(rx_end);&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;else&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; days_overlap=max(intck('dtday',rx_start, lag(rx_end_new)),&lt;STRONG&gt;0&lt;/STRONG&gt;);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;if&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;days_overlap=&lt;STRONG&gt;0&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;then&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rx_start_new=datepart(rx_start);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rx_end_new=datepart(rx_end);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;else&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;if&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;days_overlap &amp;gt;&lt;STRONG&gt;0&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;then&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rx_start_new=intnx('day',datepart(rx_start),days_overlap);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rx_end_new=intnx('day',datepart(rx_end),days_overlap);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;end;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;AND&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;temp3;&lt;/P&gt;&lt;P&gt;set&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;temp2;&lt;/P&gt;&lt;P&gt;by&amp;nbsp; person_id class_category molecule strength rx_start rx_end;&lt;/P&gt;&lt;P&gt;retain&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;days_overlap rx_start_new rx_end_new;&lt;/P&gt;&lt;P&gt;rx_start_new=&lt;STRONG&gt;.&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;rx_end_new=&lt;STRONG&gt;.&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;lagrx_start=lag(rx_start_new);&lt;/P&gt;&lt;P&gt;lagrx_end=lag(rx_end_new);&lt;/P&gt;&lt;P&gt;days_overlap=&lt;STRONG&gt;.&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;format&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;rx_start_new rx_end_new&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;mmddyy10.;&lt;/P&gt;&lt;P&gt;if&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;first.person_id&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;then&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; days_overlap=&lt;STRONG&gt;0&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rx_start_new=datepart(rx_start);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rx_end_new=datepart(rx_end);&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;else&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;if&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;rx_start &amp;lt; lag(rx_end_new)&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;then&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; days_overlap=intck('dtday',rx_start, lagrx_end);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rx_start_new=intnx('day',rx_start,days_overlap);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rx_start_end=intnx('day',rx_end, days_overlap);&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;else&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; days_overlap=&lt;STRONG&gt;0&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rx_start_new=datepart(rx_start);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rx_end_new=datepart(rx_end);&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Neither is working properly.&amp;nbsp; So, I could really use some advice!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Aug 2018 21:13:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Manipulating-overlapping-date-claims-and-shifting-them-forward/m-p/485962#M126334</guid>
      <dc:creator>tntmph0</dc:creator>
      <dc:date>2018-08-10T21:13:32Z</dc:date>
    </item>
    <item>
      <title>Re: Manipulating overlapping date claims and shifting them forward</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Manipulating-overlapping-date-claims-and-shifting-them-forward/m-p/485972#M126339</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;

data have;
input (rx_start	rx_end) (:mmddyy10.) ;
format rx_start	rx_end mmddyy10.;
cards;
5/28/2014	6/27/2014
6/28/2014	7/28/2014
7/26/2014	8/25/2014
8/24/2014	9/23/2014
9/21/2014	10/21/2014
10/25/2014	11/24/2014
11/22/2014	12/22/2014
12/20/2014	1/19/2015
;

data w1;
set have;
retain _s _e;
if _n_=1 then do;
_s=rx_start;
_e=rx_end;
end;
else do;
if rx_start&amp;lt;_e then do;
k=_e-rx_start;
_s=rx_start+k;
/*not sure either intnx('month',_s,1,'s')-1 or intnx('month',_s,1,'s')*/
_e=intnx('month',_s,1,'s')-1;
end;
else if rx_start&amp;gt;=_e then do;
_s=rx_start;
_e=rx_end;
end;
end;
format _: mmddyy10.;
keep _: k;
run;
/*or */

data w2;
set have;
retain _s _e;
if _n_=1 or rx_start&amp;gt;=_e  then do;
_s=rx_start;
_e=rx_end;
end;
else do;
if rx_start&amp;lt;_e then do;
_s=_e;
/*not sure either intnx('month',_s,1,'s')-1 or intnx('month',_s,1,'s')*/
_e=intnx('month',_s,1,'s')-1;
end;
end;
format _: mmddyy10.;
keep _:;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or both garbage &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Aug 2018 22:16:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Manipulating-overlapping-date-claims-and-shifting-them-forward/m-p/485972#M126339</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-08-10T22:16:48Z</dc:date>
    </item>
    <item>
      <title>Re: Manipulating overlapping date claims and shifting them forward</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Manipulating-overlapping-date-claims-and-shifting-them-forward/m-p/485978#M126340</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;Neither is working properly.&amp;nbsp; So, I could really use some advice!&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Show the desired output for your given input.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Aug 2018 22:54:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Manipulating-overlapping-date-claims-and-shifting-them-forward/m-p/485978#M126340</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-08-10T22:54:50Z</dc:date>
    </item>
    <item>
      <title>Re: Manipulating overlapping date claims and shifting them forward</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Manipulating-overlapping-date-claims-and-shifting-them-forward/m-p/486075#M126387</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/106860"&gt;@tntmph0&lt;/a&gt;:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your specs look suspicious. You say that you want your overlapping dates to stretch "continuously" (methinks "contiguously" would be a better word), and yet when you have an overlap you want the next range to begin at the date on which the prior range ends. It means that your new output ranges will still overlap, albeit by 1 day. In other words, for two adjacent ranges&amp;nbsp;[1:5] and [3:7], you want the new ranges to be [1:5] and [5:9], though it seems more logical to have the second range as [6:10].&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At any rate, you code seems too complex for the purpose. You just need to &lt;EM&gt;accumulate&lt;/EM&gt; the "advance" value with each new overlap and add it to the beginning and end of each original interval. Also, claim files like these are normally grouped by member ID, and each member group is processed independently. To account for that, below, I've expanded your sample input with ID=1 and ID=2. The macro parm GAP=-1 is set per your specs to the (negative) number of days by which you want the new ranges to overlap. If you really want &lt;EM&gt;contiguous&lt;/EM&gt; ranges (the next begins with the day following the end of the prior), set GAP=0. If you want a gap between the new intervals, set GAP to the corresponding &lt;EM&gt;positive&lt;/EM&gt; number of days.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ;                                                      
  input id (rx_start rx_end) (:mmddyy10.) ;                      
  cards ;                                                        
1  5/28/2014   6/27/2014                                         
1  6/28/2014   7/28/2014                                         
1  7/26/2014   8/25/2014                                         
1  8/24/2014   9/23/2014                                         
1  9/21/2014  10/21/2014                                         
1 10/25/2014  11/24/2014                                         
1 11/22/2014  12/22/2014                                         
1 12/20/2014   1/19/2015                                         
2  5/28/2014   6/27/2014                                         
2  6/28/2014   7/28/2014                                         
2  7/26/2014   8/25/2014                                         
2  8/24/2014   9/23/2014                                         
2  9/21/2014  10/21/2014                                         
2 10/25/2014  11/24/2014                                         
2 11/22/2014  12/22/2014                                         
2 12/20/2014   1/19/2015                                         
run ;                                                            
&lt;BR /&gt;%let gap = -1 ; * per your specs ;&lt;BR /&gt;                                                                 
data want (drop = _:) ;                                          
  do until (last.id) ;                                           
    set have (rename=(rx_start=_rxs rx_end=_rxe)) ;              
    by id ;                                                      
    _adv = sum (_adv, sum (_p, - _rxs, 1 + &amp;amp;gap) * (_p &amp;gt; _rxs)) ;
    rx_start = _rxs + _adv ;                                     
    rx_end   = _rxe + _adv ;                                     
    output ;                                                     
    _p = _rxe ;                                                  
  end ;                                                          
  format rx: yymmdd10. ;                                         
run ;                                                            &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;If you want no member ID groups involved and process the whole file as a single blob, change the program to:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want (drop = _:) ;                                          
  do until (last) ;                                              
    set have (rename=(rx_start=_rxs rx_end=_rxe)) end = last ;   
    _adv = sum (_adv, sum (_p, - _rxs, 1 + &amp;amp;gap) * (_p &amp;gt; _rxs)) ;
    rx_start = _rxs + _adv ;                                     
    rx_end   = _rxe + _adv ;                                     
    output ;                                                     
    _p = _rxe ;                                                  
  end ;                                                          
  format rx: yymmdd10. ;                                         
run ;                                                            &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;HTH&lt;/P&gt;&lt;P&gt;Paul D.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 11 Aug 2018 19:13:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Manipulating-overlapping-date-claims-and-shifting-them-forward/m-p/486075#M126387</guid>
      <dc:creator>hashman</dc:creator>
      <dc:date>2018-08-11T19:13:59Z</dc:date>
    </item>
    <item>
      <title>Re: Manipulating overlapping date claims and shifting them forward</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Manipulating-overlapping-date-claims-and-shifting-them-forward/m-p/486178#M126451</link>
      <description>What I have&lt;BR /&gt;person_id rx_start rx_end&lt;BR /&gt;1801 5/28/2014 6/27/2014&lt;BR /&gt;1801 6/28/2014 7/28/2014&lt;BR /&gt;1801 7/26/2014 8/25/2014&lt;BR /&gt;1801 8/24/2014 9/23/2014&lt;BR /&gt;1801 9/21/2014 10/21/2014&lt;BR /&gt;1801 10/25/2014 11/24/2014&lt;BR /&gt;1801 11/22/2014 12/22/2014&lt;BR /&gt;1801 12/20/2014 1/19/2015&lt;BR /&gt;2001 10/6/2014 11/5/2014&lt;BR /&gt;2001 11/4/2014 12/4/2014&lt;BR /&gt;2001 12/2/2014 1/1/2015&lt;BR /&gt;2001 12/30/2014 1/29/2015&lt;BR /&gt;what I want&lt;BR /&gt;person_id rx_start rx_end days_overlap rx_start_new rx_end_new&lt;BR /&gt;1801 5/28/2014 6/27/2014 0 5/28/2014 6/27/2014&lt;BR /&gt;1801 6/28/2014 7/28/2014 0 6/28/2014 7/28/2014&lt;BR /&gt;1801 7/26/2014 8/25/2014 2 7/28/2014 8/26/2014&lt;BR /&gt;1801 8/24/2014 9/23/2014 2 8/26/2014 9/25/2014&lt;BR /&gt;1801 9/21/2014 10/21/2014 4 9/25/2014 10/25/2014&lt;BR /&gt;1801 10/25/2014 11/24/2014 0 10/25/2014 11/24/2014&lt;BR /&gt;1801 11/22/2014 12/22/2014 2 11/24/2014 12/24/2014&lt;BR /&gt;1801 12/20/2014 1/19/2015 4 12/24/2014 1/23/2014&lt;BR /&gt;2001 10/6/2014 11/5/2014 0 10/6/2014 11/5/2014&lt;BR /&gt;2001 11/4/2014 12/4/2014 1 11/5/2014 12/5/2014&lt;BR /&gt;2001 12/2/2014 1/1/2015 3 12/5/2014 1/4/2015&lt;BR /&gt;2001 12/30/2014 1/29/2015 5 1/4/2015 2/3/2015&lt;BR /&gt;Any thoughts on how I can achieve this?&lt;BR /&gt;</description>
      <pubDate>Sun, 12 Aug 2018 18:08:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Manipulating-overlapping-date-claims-and-shifting-them-forward/m-p/486178#M126451</guid>
      <dc:creator>tntmph0</dc:creator>
      <dc:date>2018-08-12T18:08:22Z</dc:date>
    </item>
    <item>
      <title>Re: Manipulating overlapping date claims and shifting them forward</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Manipulating-overlapping-date-claims-and-shifting-them-forward/m-p/486180#M126453</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;You are correct, in my (clearly failed) attempt to explain my problem, yes,&lt;BR /&gt;I meant 'contiguously' and yes, in need it by patient id. Another point is&lt;BR /&gt;the gap or days overlap varies depending on the prior claim's 'new date'.&lt;BR /&gt;It isn't constant. This is what I have:&lt;BR /&gt;&lt;BR /&gt;person_id rx_start rx_end&lt;BR /&gt;1801 5/28/2014 6/27/2014&lt;BR /&gt;1801 6/28/2014 7/28/2014&lt;BR /&gt;1801 7/26/2014 8/25/2014&lt;BR /&gt;1801 8/24/2014 9/23/2014&lt;BR /&gt;1801 9/21/2014 10/21/2014&lt;BR /&gt;1801 10/25/2014 11/24/2014&lt;BR /&gt;1801 11/22/2014 12/22/2014&lt;BR /&gt;1801 12/20/2014 1/19/2015&lt;BR /&gt;2001 10/6/2014 11/5/2014&lt;BR /&gt;2001 11/4/2014 12/4/2014&lt;BR /&gt;2001 12/2/2014 1/1/2015&lt;BR /&gt;2001 12/30/2014 1/29/2015&lt;BR /&gt;This is what I want:&lt;BR /&gt;&lt;BR /&gt;person_id rx_start rx_end days_overlap rx_start_new rx_end_new&lt;BR /&gt;1801 5/28/2014 6/27/2014 0 5/28/2014 6/27/2014&lt;BR /&gt;1801 6/28/2014 7/28/2014 0 6/28/2014 7/28/2014&lt;BR /&gt;1801 7/26/2014 8/25/2014 2 7/28/2014 8/26/2014&lt;BR /&gt;1801 8/24/2014 9/23/2014 2 8/26/2014 9/25/2014&lt;BR /&gt;1801 9/21/2014 10/21/2014 4 9/25/2014 10/25/2014&lt;BR /&gt;1801 10/25/2014 11/24/2014 0 10/25/2014 11/24/2014&lt;BR /&gt;1801 11/22/2014 12/22/2014 2 11/24/2014 12/24/2014&lt;BR /&gt;1801 12/20/2014 1/19/2015 4 12/24/2014 1/23/2014&lt;BR /&gt;2001 10/6/2014 11/5/2014 0 10/6/2014 11/5/2014&lt;BR /&gt;2001 11/4/2014 12/4/2014 1 11/5/2014 12/5/2014&lt;BR /&gt;2001 12/2/2014 1/1/2015 3 12/5/2014 1/4/2015&lt;BR /&gt;2001 12/30/2014 1/29/2015 5 1/4/2015 2/3/2015&lt;BR /&gt;</description>
      <pubDate>Sun, 12 Aug 2018 18:23:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Manipulating-overlapping-date-claims-and-shifting-them-forward/m-p/486180#M126453</guid>
      <dc:creator>tntmph0</dc:creator>
      <dc:date>2018-08-12T18:23:22Z</dc:date>
    </item>
  </channel>
</rss>

