<?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 How to identify overlapping dates and assign them an identifier? in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-to-identify-overlapping-dates-and-assign-them-an-identifier/m-p/531228#M5869</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table with patient Id, treatment type, date of first prescription and date of last prescription. I want to create a new column (variable) which will return 1 if the first prescription date plus 30 days overlaps with the last prescription date, otherwise assign it a value of 0.&amp;nbsp; i tried using the retain function but no results. Can you please help me?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/26690iFBA553F615BC9C2D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 30 Jan 2019 01:32:58 GMT</pubDate>
    <dc:creator>reem225</dc:creator>
    <dc:date>2019-01-30T01:32:58Z</dc:date>
    <item>
      <title>How to identify overlapping dates and assign them an identifier?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-identify-overlapping-dates-and-assign-them-an-identifier/m-p/531228#M5869</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table with patient Id, treatment type, date of first prescription and date of last prescription. I want to create a new column (variable) which will return 1 if the first prescription date plus 30 days overlaps with the last prescription date, otherwise assign it a value of 0.&amp;nbsp; i tried using the retain function but no results. Can you please help me?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/26690iFBA553F615BC9C2D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jan 2019 01:32:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-identify-overlapping-dates-and-assign-them-an-identifier/m-p/531228#M5869</guid>
      <dc:creator>reem225</dc:creator>
      <dc:date>2019-01-30T01:32:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to identify overlapping dates and assign them an identifier?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-identify-overlapping-dates-and-assign-them-an-identifier/m-p/531236#M5870</link>
      <description>&lt;P&gt;Assuming your dates are SAS dates:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;overlap = intnx("DAY", date, 30) &amp;gt;= lastdate;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jan 2019 03:02:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-identify-overlapping-dates-and-assign-them-an-identifier/m-p/531236#M5870</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2019-01-30T03:02:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to identify overlapping dates and assign them an identifier?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-identify-overlapping-dates-and-assign-them-an-identifier/m-p/531243#M5871</link>
      <description>&lt;P&gt;Thank you so much!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;they are sas dates and works!&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jan 2019 03:35:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-identify-overlapping-dates-and-assign-them-an-identifier/m-p/531243#M5871</guid>
      <dc:creator>reem225</dc:creator>
      <dc:date>2019-01-30T03:35:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to identify overlapping dates and assign them an identifier?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-identify-overlapping-dates-and-assign-them-an-identifier/m-p/531398#M5895</link>
      <description>&lt;P&gt;I now noticed that once there is only 1 prescription and no last prescription the overlap is assigned as 1, is there a way to overcome that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my code:&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/26708iCD19233C5F5A9F35/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data overlap ;
		set Rxfinal ;
		by id date ;
	    lagtrt= lag(treatment);
	    if first.id then lagtrt=treatment;
		if not first.id then lagtrt=0 ; 
		switch = intnx("DAY", date, 30) &amp;gt;= lastdate;
		run ;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Jan 2019 15:32:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-identify-overlapping-dates-and-assign-them-an-identifier/m-p/531398#M5895</guid>
      <dc:creator>reem225</dc:creator>
      <dc:date>2019-01-30T15:32:26Z</dc:date>
    </item>
  </channel>
</rss>

