<?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 compare 2 adjacent values when using %do %until in SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-adjacent-values-when-using-do-until-in-SAS/m-p/452572#M283903</link>
    <description>&lt;P&gt;Thank you to answer my question.&lt;/P&gt;&lt;P&gt;In fact, I want to know if end_A &amp;gt; end1, whether end_A &amp;gt; end(i) (i=2-4).&amp;nbsp;&lt;/P&gt;&lt;P&gt;In fact, I have a more variable begin_A, and I want to know whether the period between begin_A and end_A is within a period from begin1 to end 4. If it's in begin1-end1, it's ok, but if end_A &amp;gt; end1 (begin1 &amp;lt; beginA), then I must test begin2-end2, it means end_A &amp;lt;= end2 AND begin2 &amp;lt;=end1. And if end_A &amp;gt; end2, I must continue testing begin3-end3. I will do like this until begin4-end4.&lt;/P&gt;&lt;P&gt;I just think do until will help me to run from 2 to 4, but now I'm thinking how to know if it's true in end2 or end3 (end_A &amp;lt;end2 par example)&lt;/P&gt;</description>
    <pubDate>Mon, 09 Apr 2018 17:28:13 GMT</pubDate>
    <dc:creator>Poisonous_Snake</dc:creator>
    <dc:date>2018-04-09T17:28:13Z</dc:date>
    <item>
      <title>How to compare 2 adjacent values when using %do %until in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-adjacent-values-when-using-do-until-in-SAS/m-p/452342#M283898</link>
      <description>&lt;P&gt;Hello everybody,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I have a problem while using macro in SAS. I have the table like this:&lt;/P&gt;&lt;P&gt;ID&amp;nbsp; &amp;nbsp; begin 1&amp;nbsp; &amp;nbsp; &amp;nbsp;begin 2&amp;nbsp; &amp;nbsp; begin 3&amp;nbsp; &amp;nbsp; &amp;nbsp;begin 4&amp;nbsp; &amp;nbsp; &amp;nbsp; end 1&amp;nbsp; &amp;nbsp; &amp;nbsp;end 2&amp;nbsp; &amp;nbsp; end 3&amp;nbsp; &amp;nbsp; &amp;nbsp; end 4&amp;nbsp; &amp;nbsp; &amp;nbsp;end_A&lt;/P&gt;&lt;P&gt;Now I want to use macro like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;%do i = 1 %to &amp;amp;e;&lt;/P&gt;&lt;P&gt;&amp;nbsp;%if end_A &amp;gt; end&amp;amp;i %then %do %until (end_A &amp;gt; end&amp;amp;i) AND (begin(&amp;amp;i+1) &amp;lt;=end&amp;amp;i);&lt;/P&gt;&lt;P&gt;&amp;nbsp; %let i = %eval(&amp;amp;i+1);&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;But I don't know how to write begin(&amp;amp;i+1) in this macro so computer will understand for example if i=2 then begin 2 (&amp;amp;i+1) &amp;lt;= end 1 (&amp;amp;i).&lt;/P&gt;&lt;P&gt;Can anyone help me?&lt;/P&gt;&lt;P&gt;Thank you guys very much!&lt;/P&gt;</description>
      <pubDate>Sun, 08 Apr 2018 17:22:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-adjacent-values-when-using-do-until-in-SAS/m-p/452342#M283898</guid>
      <dc:creator>Poisonous_Snake</dc:creator>
      <dc:date>2018-04-08T17:22:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare 2 adjacent values when using %do %until in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-adjacent-values-when-using-do-until-in-SAS/m-p/452351#M283899</link>
      <description>&lt;P&gt;Did you try using %eval function for evaluating&amp;nbsp; the sum.&lt;/P&gt;</description>
      <pubDate>Sun, 08 Apr 2018 18:34:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-adjacent-values-when-using-do-until-in-SAS/m-p/452351#M283899</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2018-04-08T18:34:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare 2 adjacent values when using %do %until in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-adjacent-values-when-using-do-until-in-SAS/m-p/452354#M283900</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Try this */&lt;BR /&gt;%do i = 1 %to &amp;amp;e;
%if end_A &amp;gt; end&amp;amp;i %then %do %until ((end_A &amp;gt; end&amp;amp;i) AND (begin%eval(&amp;amp;i+1) &amp;lt;=end&amp;amp;i));
%let i = %eval(&amp;amp;i+1);/* Why */
%end;
%end;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Provide some example data and the result your looking for. What are you trying&amp;nbsp; to achive?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why do you need &lt;STRONG&gt;%let i=%eval(&amp;amp;i+1);&lt;/STRONG&gt;&amp;nbsp; In do loop it will automatically increment.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Apr 2018 18:54:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-adjacent-values-when-using-do-until-in-SAS/m-p/452354#M283900</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2018-04-08T18:54:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare 2 adjacent values when using %do %until in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-adjacent-values-when-using-do-until-in-SAS/m-p/452360#M283901</link>
      <description>&lt;P&gt;It's possible you've been bitten by the Poisonous Macro Snake.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you truly have a table with the structure you have described, macro language would be of no use.&amp;nbsp; A DATA step processes data in a table.&lt;/P&gt;</description>
      <pubDate>Sun, 08 Apr 2018 20:31:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-adjacent-values-when-using-do-until-in-SAS/m-p/452360#M283901</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-04-08T20:31:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare 2 adjacent values when using %do %until in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-adjacent-values-when-using-do-until-in-SAS/m-p/452397#M283902</link>
      <description>&lt;P&gt;Macro code is for generating SAS code. SAS code is used to reference data.&lt;/P&gt;
&lt;P&gt;Macro code will not help with this problem.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is some SAS code that might help you.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;array begin (4);
array end (4);
do i=1 to dim(end);
  if end_a &amp;gt; end(i) then
   do j=i+1 to dim(begin) until (end_a &amp;gt; end(i) and begin(j) &amp;lt; end(i)) ;
     * What do you want to do here? ;
  end;
end;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Apr 2018 03:47:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-adjacent-values-when-using-do-until-in-SAS/m-p/452397#M283902</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-04-09T03:47:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare 2 adjacent values when using %do %until in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-adjacent-values-when-using-do-until-in-SAS/m-p/452572#M283903</link>
      <description>&lt;P&gt;Thank you to answer my question.&lt;/P&gt;&lt;P&gt;In fact, I want to know if end_A &amp;gt; end1, whether end_A &amp;gt; end(i) (i=2-4).&amp;nbsp;&lt;/P&gt;&lt;P&gt;In fact, I have a more variable begin_A, and I want to know whether the period between begin_A and end_A is within a period from begin1 to end 4. If it's in begin1-end1, it's ok, but if end_A &amp;gt; end1 (begin1 &amp;lt; beginA), then I must test begin2-end2, it means end_A &amp;lt;= end2 AND begin2 &amp;lt;=end1. And if end_A &amp;gt; end2, I must continue testing begin3-end3. I will do like this until begin4-end4.&lt;/P&gt;&lt;P&gt;I just think do until will help me to run from 2 to 4, but now I'm thinking how to know if it's true in end2 or end3 (end_A &amp;lt;end2 par example)&lt;/P&gt;</description>
      <pubDate>Mon, 09 Apr 2018 17:28:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-adjacent-values-when-using-do-until-in-SAS/m-p/452572#M283903</guid>
      <dc:creator>Poisonous_Snake</dc:creator>
      <dc:date>2018-04-09T17:28:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare 2 adjacent values when using %do %until in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-adjacent-values-when-using-do-until-in-SAS/m-p/452577#M283904</link>
      <description>Thank you to concern about my question.&lt;BR /&gt;I only want to increment i in the loop do until, for example: when i = 1, if end_A &amp;gt; end1 then do until (end_A &amp;gt; end(i)), at this time, i will increase up to 4 to evaluate whether end_A &amp;gt; end(i), meanwhile the i outside for the if then (end_A &amp;gt; end1) still equal 1.&lt;BR /&gt;I try to write begin(%eval(&amp;amp;i+1)) but the computer don't understand, in fact it makes my %end begin a text instead of a command.&lt;BR /&gt;Now I really want to know how to know how many loops do we have for each end_A. I try to assign a new variable n, but after %let n = 0 and %let n = %eval(&amp;amp;n+1) in the loop %do %until, I don't know how to express n in the table. Can you help me?</description>
      <pubDate>Mon, 09 Apr 2018 17:42:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-adjacent-values-when-using-do-until-in-SAS/m-p/452577#M283904</guid>
      <dc:creator>Poisonous_Snake</dc:creator>
      <dc:date>2018-04-09T17:42:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare 2 adjacent values when using %do %until in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-adjacent-values-when-using-do-until-in-SAS/m-p/452586#M283905</link>
      <description>&lt;P&gt;Not sure what you are asking exactly.&lt;/P&gt;
&lt;P&gt;I would recommend creating a small example dataset and posting it.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ;
  input id begin1-begin4 end1-end4 begin_a end_a ;
  informat begin1-begin4 end1-end4  begin_a end_a yymmdd.;
  format begin1-begin4 end1-end4  begin_a end_a yymmdd10. ;
cards;
1 2017-01-01 . . . 2017-03-01 . . . 2017-02-01 2017-02-14
;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Include an example dataset that shows what you are trying to calculate. If you are just trying to make new variables then include them in the original sample.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Apr 2018 18:10:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-adjacent-values-when-using-do-until-in-SAS/m-p/452586#M283905</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-04-09T18:10:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare 2 adjacent values when using %do %until in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-adjacent-values-when-using-do-until-in-SAS/m-p/452588#M283906</link>
      <description>&lt;P&gt;Macro code is for manipulating text and is mainly used to generate code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If cannot reference values of dataset variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not sure what your task really is, but perhaps one place you could use macro code is if you wanted to generate a series of comparison statements to use in a data step.&amp;nbsp; For example if you wanted to calculate 4 boolean variables named TEST1 to TEST2 where each one compares a different BEGINxxx variable to the variable END_A then the macro code might look like this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%do i=1 to 4 ;
test&amp;amp;i = begin&amp;amp;i &amp;lt; end_a ;
%end;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So if you did that in the middle of a data step you would have generate four assignment statements to create those four new variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Apr 2018 18:08:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-adjacent-values-when-using-do-until-in-SAS/m-p/452588#M283906</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-04-09T18:08:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare 2 adjacent values when using %do %until in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-adjacent-values-when-using-do-until-in-SAS/m-p/452871#M283907</link>
      <description>&lt;P&gt;I created an example below for you (I really hope you can help me. Thank you very much hihi). In fact, I want to know whether B (defined by begin_B and end_B) is used with A (defined by begin_Ai to end_Ai). Is it clearer?&lt;/P&gt;</description>
      <pubDate>Tue, 10 Apr 2018 15:59:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-adjacent-values-when-using-do-until-in-SAS/m-p/452871#M283907</guid>
      <dc:creator>Poisonous_Snake</dc:creator>
      <dc:date>2018-04-10T15:59:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare 2 adjacent values when using %do %until in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-adjacent-values-when-using-do-until-in-SAS/m-p/452882#M283908</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/203530"&gt;@Poisonous_Snake&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I created an example below for you (I really hope you can help me. Thank you very much hihi). In fact, I want to know whether B (defined by begin_B and end_B) is used with A (defined by begin_Ai to end_Ai). Is it clearer?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To post data do it in the form of a data step that reads from in-line records. Like the example I posted above.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Apr 2018 16:23:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-adjacent-values-when-using-do-until-in-SAS/m-p/452882#M283908</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-04-10T16:23:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare 2 adjacent values when using %do %until in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-adjacent-values-when-using-do-until-in-SAS/m-p/452884#M283909</link>
      <description>I'm sorry for misunderstanding you, do you mean that?&lt;BR /&gt;data example;&lt;BR /&gt;input STT begin_A1 begin_A2 begin_A3 begin_A4 end_A1 end_A2 end_A3 end_A4 begin_B end_B;&lt;BR /&gt;informat begin_A1 begin_A2 begin_A3 begin_A4 end_A1 end_A2 end_A3 end_A4 begin_B end_B ddmmyy.;&lt;BR /&gt;format begin_A1 begin_A2 begin_A3 begin_A4 end_A1 end_A2 end_A3 end_A4 begin_B end_B ddmmyy10.;&lt;BR /&gt;cards;&lt;BR /&gt;1 12/06/2014 17/06/2014 25/06/2014 01/07/2014 27/06/2014 02/07/2014 10/07/2014 16/07/2014 17/06/2014 15/07/2014&lt;BR /&gt;2 28/05/2014 12/06/2014 17/06/2014 25/06/2014 12/06/2014 27/06/2014 02/07/2014 10/07/2014 12/06/2014 10/07/2014&lt;BR /&gt;RUN;</description>
      <pubDate>Tue, 10 Apr 2018 16:29:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-adjacent-values-when-using-do-until-in-SAS/m-p/452884#M283909</guid>
      <dc:creator>Poisonous_Snake</dc:creator>
      <dc:date>2018-04-10T16:29:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare 2 adjacent values when using %do %until in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-adjacent-values-when-using-do-until-in-SAS/m-p/452889#M283910</link>
      <description>&lt;P&gt;Yes. Make sure to use either the Insert Code&amp;nbsp; or Insert SAS Code icons on the menu bar so that your formatting is not loss.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now that you have posted data tell us what you want to calculate from that data.&lt;/P&gt;
&lt;P&gt;Do you want to derive new variables on each observation?&lt;/P&gt;
&lt;P&gt;Do you want to subset that to observations that meet some criteria?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Explain what you want and post the expected result for your sample data.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Apr 2018 16:40:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-adjacent-values-when-using-do-until-in-SAS/m-p/452889#M283910</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-04-10T16:40:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare 2 adjacent values when using %do %until in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-adjacent-values-when-using-do-until-in-SAS/m-p/452894#M283911</link>
      <description>&lt;P&gt;I want to know whether B is used with A. For example, the period from begin_A1 to end_A1 contains begin_B -&amp;gt; starting using B when using A. But end_B is out of this period, so I must evaluate the next period, which means begin_A2 to end_A2, but end_B &amp;gt; end_A2, so we continue evaluating begin_A3 - end_A3, meanwhile, begin_A2 &amp;lt; end_A1,&amp;nbsp; which means A continues being used while using B. I evaluate like that until begin_A4 - end_A4 to know whether end_B &amp;gt; end_A4 (that means finishing A before finishing B) or end_B &amp;lt; end_A4 (that means B is used with A).&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to know the final result (end_B &amp;gt; end_A4 or end_B &amp;lt; end_A4), meanwhile the condition begin_A2 &amp;lt;= end_A1, begin_A3 &amp;lt;= end_A2, begin_A4 &amp;lt;= end_A3 is reassured. If this condition is wrong, I don't have to evaluate until end_A4.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Apr 2018 16:59:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-adjacent-values-when-using-do-until-in-SAS/m-p/452894#M283911</guid>
      <dc:creator>Poisonous_Snake</dc:creator>
      <dc:date>2018-04-10T16:59:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare 2 adjacent values when using %do %until in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-adjacent-values-when-using-do-until-in-SAS/m-p/452900#M283912</link>
      <description>&lt;P&gt;That is as clear as mud.&lt;/P&gt;
&lt;P&gt;You have a series of intervals.&amp;nbsp; And you want to compare it to a new interval.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Do you want to only find the interval from the series that complete covers the new interval?&lt;/P&gt;
&lt;P&gt;So find the first I such that this criteria is true:&lt;/P&gt;
&lt;PRE&gt;begin(i) &amp;lt;= beginB &amp;lt;= endB &amp;lt;= end(i)&lt;/PRE&gt;
&lt;P&gt;Or do you want to construct a new smallest interval by combining different begin and end date?&lt;/P&gt;
&lt;P&gt;Find the max(I) and min(J) with I&amp;lt;=J that meet this criteria:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;begin(i) &amp;lt;= beginB &amp;lt;= endB &amp;lt;= end(j)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Apr 2018 17:09:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-adjacent-values-when-using-do-until-in-SAS/m-p/452900#M283912</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-04-10T17:09:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare 2 adjacent values when using %do %until in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-adjacent-values-when-using-do-until-in-SAS/m-p/452903#M283913</link>
      <description>No, although there is a series of intervals, but these are intervals of A, so if these intervals are overlap, it means you use A continuously, (you can image that you are delivered candy A 4 times, but because the period of each candy A delivrance is overlap, so you eat candy A everyday sans cease), in that case, I know to know if the interval from the begin of A (the first time delivering candy A) to the end of A (the time you eat your last candy A) is cover interval of B (supposed that is a new kind of candy B).&lt;BR /&gt;In case of these intervals of A are disrupted, which means you have some seperated intervals of A, so when the interval of B fall in these intervals of A, it is not covered.&lt;BR /&gt;There is another case that only one interval or two intervals of A can cover interval of B.&lt;BR /&gt;And I only want to know if interval of B is completely covered by interval(s) of A.</description>
      <pubDate>Tue, 10 Apr 2018 17:30:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-adjacent-values-when-using-do-until-in-SAS/m-p/452903#M283913</guid>
      <dc:creator>Poisonous_Snake</dc:creator>
      <dc:date>2018-04-10T17:30:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare 2 adjacent values when using %do %until in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-adjacent-values-when-using-do-until-in-SAS/m-p/452913#M283914</link>
      <description>&lt;P&gt;I can see two methods to fix this.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One is to first collapse your A intervals so that they do represent separate intervals. Then loop over them and check if B falls in any of them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The other is to brute force it.&amp;nbsp; Make a large temporary array with one element for each possible day.&amp;nbsp; Process the A records to fill in the days each covers. Then loop of the days of the B interval and see if all of the days are covered.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Apr 2018 18:15:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-adjacent-values-when-using-do-until-in-SAS/m-p/452913#M283914</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-04-10T18:15:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare 2 adjacent values when using %do %until in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-adjacent-values-when-using-do-until-in-SAS/m-p/453199#M283915</link>
      <description>&lt;P&gt;I think about collapse the intervals of A into only one interval of A (if they are overlap), so now I'm trying to do it, although there are some problems (because there are more conditions for A and B), but that's the only way I can do right now.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For your second solution, I don't really understand it.&lt;/P&gt;&lt;P&gt;Thank you for helping me hihi&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Apr 2018 13:30:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-compare-2-adjacent-values-when-using-do-until-in-SAS/m-p/453199#M283915</guid>
      <dc:creator>Poisonous_Snake</dc:creator>
      <dc:date>2018-04-11T13:30:08Z</dc:date>
    </item>
  </channel>
</rss>

