<?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: How to Output Overlap Ranges in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-Output-Overlap-Ranges/m-p/491091#M128699</link>
    <description>&lt;P&gt;see if this helps. Please test thoroughly&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 temp;
set have;
by city address notsorted;
retain f;
if first.address then f=0;
if not first.address and not(num1&amp;lt;lag(num2)) then f+1;
else f=0;
run;

data want;
set temp;
by city address f notsorted;
if not(first.f and last.f) and f=0 then output ;
drop f;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 30 Aug 2018 05:18:00 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2018-08-30T05:18:00Z</dc:date>
    <item>
      <title>How to Output Overlap Ranges</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Output-Overlap-Ranges/m-p/491058#M128677</link>
      <description>&lt;P&gt;Hi, I'd like to output which ranges overlap (no fixing of affected ranges required).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data HAVE;&lt;BR /&gt;infile datalines dlm="|";&lt;BR /&gt;input NUM1 NUM2 ADDRESS :$12. CITY :$12.;&lt;BR /&gt;datalines;&lt;BR /&gt;0|2|GREEN ROAD|RED CITY&lt;BR /&gt;1|4|GREEN ROAD|RED CITY&lt;BR /&gt;3|4|GREEN ROAD|RED CITY&lt;BR /&gt;5|7|GREEN ROAD|RED CITY&lt;BR /&gt;2|9|WHITE ROAD|RED CITY&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/*Output affected Ranges*/&lt;BR /&gt;data WANT;&lt;BR /&gt;infile datalines dlm="|";&lt;BR /&gt;input NUM1 NUM2 ADDRESS :$12. CITY :$12.;&lt;BR /&gt;datalines;&lt;BR /&gt;0|2|GREEN ROAD|RED CITY&lt;BR /&gt;1|4|GREEN ROAD|RED CITY&lt;BR /&gt;3|4|GREEN ROAD|RED CITY&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Aug 2018 03:13:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Output-Overlap-Ranges/m-p/491058#M128677</guid>
      <dc:creator>angeliquec</dc:creator>
      <dc:date>2018-08-30T03:13:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to Output Overlap Ranges</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Output-Overlap-Ranges/m-p/491068#M128682</link>
      <description>&lt;P&gt;I hope this meets your requirement&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data HAVE;
infile datalines dlm="|";
input NUM1 NUM2 ADDRESS :$12. CITY :$12.;
datalines;
0|2|GREEN ROAD|RED CITY
1|4|GREEN ROAD|RED CITY
3|4|GREEN ROAD|RED CITY
5|7|GREEN ROAD|RED CITY
2|9|WHITE ROAD|RED CITY
;
run;

data temp;
set have;
retain f 0;
If _n_&amp;gt;1 and not(num1&amp;lt;lag(num2)) then f+1;
else f=0;
run;

data want;
set temp;
by f notsorted;
if not(first.f and last.f) and f=0 then output ;
drop f;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 30 Aug 2018 04:04:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Output-Overlap-Ranges/m-p/491068#M128682</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-08-30T04:04:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to Output Overlap Ranges</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Output-Overlap-Ranges/m-p/491084#M128693</link>
      <description>&lt;P&gt;How does 2|9 not overlap 1|4 ?&lt;/P&gt;</description>
      <pubDate>Thu, 30 Aug 2018 04:51:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Output-Overlap-Ranges/m-p/491084#M128693</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-08-30T04:51:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to Output Overlap Ranges</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Output-Overlap-Ranges/m-p/491087#M128696</link>
      <description>&lt;P&gt;2|9 is "WHITE ROAD".&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1|4 is "GREEN ROAD".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Aug 2018 05:06:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Output-Overlap-Ranges/m-p/491087#M128696</guid>
      <dc:creator>angeliquec</dc:creator>
      <dc:date>2018-08-30T05:06:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to Output Overlap Ranges</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Output-Overlap-Ranges/m-p/491090#M128698</link>
      <description>&lt;P&gt;Oh well, in that case my logic doesnt account for address groups. I may have to tweak, but too late at night in chicago now or i hope somebody else would give you more appropriate solution&lt;/P&gt;</description>
      <pubDate>Thu, 30 Aug 2018 05:09:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Output-Overlap-Ranges/m-p/491090#M128698</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-08-30T05:09:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to Output Overlap Ranges</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Output-Overlap-Ranges/m-p/491091#M128699</link>
      <description>&lt;P&gt;see if this helps. Please test thoroughly&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 temp;
set have;
by city address notsorted;
retain f;
if first.address then f=0;
if not first.address and not(num1&amp;lt;lag(num2)) then f+1;
else f=0;
run;

data want;
set temp;
by city address f notsorted;
if not(first.f and last.f) and f=0 then output ;
drop f;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 30 Aug 2018 05:18:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Output-Overlap-Ranges/m-p/491091#M128699</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-08-30T05:18:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to Output Overlap Ranges</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Output-Overlap-Ranges/m-p/491092#M128700</link>
      <description>&lt;P&gt;Of course, sorry about the silly question.&lt;/P&gt;
&lt;P&gt;The solution you picked does not spot the last overlap I think&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data HAVE;
 infile datalines dlm="|";
 input NUM1 NUM2 ADDRESS :$12. CITY :$12.;
datalines;
0|2|GREEN ROAD|RED CITY
1|4|GREEN ROAD|RED CITY
3|4|GREEN ROAD|RED CITY
5|7|GREEN ROAD|RED CITY
6|9|GREEN ROAD|RED CITY
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Aug 2018 05:20:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Output-Overlap-Ranges/m-p/491092#M128700</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-08-30T05:20:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to Output Overlap Ranges</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Output-Overlap-Ranges/m-p/491093#M128701</link>
      <description>&lt;P&gt;Like this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
   select unique t1.* 
   from  HAVE t1, HAVE t2
   where t1.ADDRESS=t2.ADDRESS 
     and t1.CITY=t2.CITY 
     and ( (t1.NUM1 &amp;lt; t2.NUM2 &amp;lt; t1.NUM2) 
          |(t1.NUM1 &amp;lt; t2.NUM1 &amp;lt; t1.NUM2)
         );
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Aug 2018 05:27:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Output-Overlap-Ranges/m-p/491093#M128701</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-08-30T05:27:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to Output Overlap Ranges</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Output-Overlap-Ranges/m-p/491094#M128702</link>
      <description>&lt;P&gt;Thank you&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data temp;
set have;
by city address notsorted;
retain f;
if first.address then f=0;
if not first.address and not(num1&amp;lt;lag(num2)) then f+1;
run;

data want;
set temp;
by city address f notsorted;
if not(first.f and last.f)  then output ;
drop f;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;sir&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;&amp;nbsp;will this work. too tired now, but will pay serious attention tomorrow morning&lt;/P&gt;</description>
      <pubDate>Thu, 30 Aug 2018 05:28:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Output-Overlap-Ranges/m-p/491094#M128702</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-08-30T05:28:09Z</dc:date>
    </item>
  </channel>
</rss>

