<?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 add additional  rows to the and statements? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-add-additional-rows-to-the-and-statements/m-p/249059#M56494</link>
    <description>Sorry durtime should be 2..I can't copy the log I have to type it</description>
    <pubDate>Tue, 09 Feb 2016 20:59:09 GMT</pubDate>
    <dc:creator>Beto16</dc:creator>
    <dc:date>2016-02-09T20:59:09Z</dc:date>
    <item>
      <title>How to add additional  rows to the and statements?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-add-additional-rows-to-the-and-statements/m-p/248548#M56440</link>
      <description>&lt;P&gt;I posted this question before I closed that post because after reading my question it was comfusing ..my apologies Enclose is a table that I've what I need is to make item C and D and statements below (IE GT,LT EQ) Thanks for your help and understanding I'm using SAS9.4&lt;BR /&gt;Proc r (x,n);x. As &amp;amp;x.&amp;amp;n. %mend;&lt;BR /&gt;A.site,a.date,a.%r (site,1),a.%r (mintime,1),a.%r (maxtime,1),a.%r (durtime,1),&lt;BR /&gt;B.site,b.date,b.%r (site,2),b.%r (mintime,2), b.%r (maxtime,2),b.%r (durtime,2&lt;/P&gt;&lt;P&gt;C.site,c.date,c.%r (site,3),c.%r (mintime,3),c.%r (maxtime,3),c.%r (durtime,3),&lt;/P&gt;&lt;P&gt;D.site,d.date,d.%r (site,4),d.%r (mintime,4),d.%r (maxtime,4),d.%r (durtime,4&lt;/P&gt;&lt;P&gt;From want as a inner join want as b on a.site =b.site want as c on a.site=c.site &amp;nbsp;want as d on a.site=D. Site&lt;BR /&gt;And (a.maxtime1 GT b.mintime2&lt;BR /&gt;And&lt;BR /&gt;A.maxtime1 LT b.maxtime2&lt;BR /&gt;)&lt;BR /&gt;Or (a.maxtime1 EQ B.maxtime2&lt;BR /&gt;and&lt;BR /&gt;Input (substr (a.site11,3,4),4.) LT Input (substr (b.site11,3,4),4.)&lt;/P&gt;&lt;P&gt;Quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 07 Feb 2016 13:31:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-add-additional-rows-to-the-and-statements/m-p/248548#M56440</guid>
      <dc:creator>Beto16</dc:creator>
      <dc:date>2016-02-07T13:31:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to add additional  rows to the and statements?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-add-additional-rows-to-the-and-statements/m-p/248551#M56441</link>
      <description>&lt;P&gt;Without seeing your macro definitions this doesn't help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please post your macro definitions and any errors you're receiving.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your current code doesn't show any WHERE conditions, so you should just be able to add more conditions to the end. If you're running into issues doing so, you'll have to really explain what you're trying to do.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 07 Feb 2016 13:47:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-add-additional-rows-to-the-and-statements/m-p/248551#M56441</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-02-07T13:47:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to add additional  rows to the and statements?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-add-additional-rows-to-the-and-statements/m-p/248555#M56443</link>
      <description>You have probably confused PROC with %macro, otherwise I can't get your code together. &lt;BR /&gt;&lt;BR /&gt;If that's SQL that you are generating I miss  select statement and probably you wish to store the result in a table, which means you need a create table statement. &lt;BR /&gt;&lt;BR /&gt;Where did you get this code, or how did you develop it?&lt;BR /&gt;Like &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt; I think you need to share some more details, like a log.</description>
      <pubDate>Sun, 07 Feb 2016 14:35:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-add-additional-rows-to-the-and-statements/m-p/248555#M56443</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-02-07T14:35:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to add additional  rows to the and statements?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-add-additional-rows-to-the-and-statements/m-p/248685#M56461</link>
      <description>&lt;P&gt;Please post example input data FOR ALL VARIABLES INVOLVED, desired output and rules if any.&lt;/P&gt;
&lt;P&gt;You have an example of comparing one apparent time range with another. But now you want to add in at least two more comparisons without saying what you want to compare. Is the A range compared with C before or after comparing with B? Is A compared with D before or after comparing with B or C? Is B compared to either C, D or Both? Or is A compared to C before B... You have a LARGE number of potential cases to address.&lt;/P&gt;
&lt;P&gt;Generally the solution is likely to involve putting entire subqueries in paranthesis to get the order correct and not just "adding AND clause members.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The presence of variables named mintime, mintime2, maxtime, maxtime2 (and do you also have a mintime3, mintime4, maxtime3 and maxtime4 that are to be used in the comparisons for C and D?) tend to make me believe that you have data at least partially in a "wide" format. Which may work better in a long form with mintime, maxtime and a period of measure variable such as 1,2,3,4 ....&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2016 20:04:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-add-additional-rows-to-the-and-statements/m-p/248685#M56461</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-02-08T20:04:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to add additional  rows to the and statements?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-add-additional-rows-to-the-and-statements/m-p/249057#M56493</link>
      <description>Here is my log when I run it&lt;BR /&gt;%macro r (x,n);&amp;amp;x. As &amp;amp;x.&amp;amp;n.%mend;&lt;BR /&gt;Pro sql;&lt;BR /&gt;Create table want as select&lt;BR /&gt;A.site,a.date,a.%r (site,1),a.%r (mintime,1),a.%r (maxtime,1),a.%r (durtime,1),&lt;BR /&gt;symbolgen: macro variable X resolves to site1&lt;BR /&gt;symbolgen: macro variable X resolves to site1&lt;BR /&gt;symbolgen: macro variable N resolves to 1&lt;BR /&gt;symbolgen: macro variable X resolves to maxtime1&lt;BR /&gt;symbolgen: macro variable X resolves to maxtime1&lt;BR /&gt;symbolgen: macro variable N resolves to 1&lt;BR /&gt;symbolgen: macro variable X resolves to mintime1&lt;BR /&gt;symbolgen: macro variable X resolves to mintime1&lt;BR /&gt;symbolgen: macro variable N resolves to 1&lt;BR /&gt;symbolgen: macro variable X resolves to durtime1&lt;BR /&gt;symbolgen: macro variable X resolves to durtime1&lt;BR /&gt;symbolgen: macro variable N resolves to 1&lt;BR /&gt;B.site,b.date,b.%r (site,2),b.%r (mintime,2), b.%r (maxtime,2),b.%r (durtime,2&lt;BR /&gt;symbolgen: macro variable X resolves to site2&lt;BR /&gt;symbolgen: macro variable X resolves to site2&lt;BR /&gt;symbolgen: macro variable N resolves to 2&lt;BR /&gt;symbolgen: macro variable X resolves to maxtime2&lt;BR /&gt;symbolgen: macro variable X resolves to maxtime2&lt;BR /&gt;symbolgen: macro variable N resolves to 2&lt;BR /&gt;symbolgen: macro variable X resolves to mintime2&lt;BR /&gt;symbolgen: macro variable X resolves to mintime2&lt;BR /&gt;symbolgen: macro variable N resolves to 2&lt;BR /&gt;symbolgen: macro variable X resolves to durtime2&lt;BR /&gt;symbolgen: macro variable X resolves to durtime3&lt;BR /&gt;symbolgen: macro variable N resolves to 2&lt;BR /&gt;From want6 as a inner join want6 as b on a.site =b.site&lt;BR /&gt;And (a.maxtime1 GT b.mintime2&lt;BR /&gt;And&lt;BR /&gt;A.maxtime1 LT b.maxtime2&lt;BR /&gt;)&lt;BR /&gt;Or (a.maxtime1 EQ B.maxtime2&lt;BR /&gt;and&lt;BR /&gt;Input (substr (a.site11,3,4),4.) LT Input (substr (b.site11,3,4),4.)&lt;BR /&gt;&lt;BR /&gt;Quit;&lt;BR /&gt;&lt;BR /&gt;The execution of this query involves performing one or more Cartesian product joins that can not be optimized.&lt;BR /&gt;the table want5 created with 3952 rows 10 columns&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 09 Feb 2016 20:57:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-add-additional-rows-to-the-and-statements/m-p/249057#M56493</guid>
      <dc:creator>Beto16</dc:creator>
      <dc:date>2016-02-09T20:57:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to add additional  rows to the and statements?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-add-additional-rows-to-the-and-statements/m-p/249059#M56494</link>
      <description>Sorry durtime should be 2..I can't copy the log I have to type it</description>
      <pubDate>Tue, 09 Feb 2016 20:59:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-add-additional-rows-to-the-and-statements/m-p/249059#M56494</guid>
      <dc:creator>Beto16</dc:creator>
      <dc:date>2016-02-09T20:59:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to add additional  rows to the and statements?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-add-additional-rows-to-the-and-statements/m-p/249066#M56496</link>
      <description>Hi Balladw&lt;BR /&gt;Your right I want to add up 2 two additional variables sometimes it occurs that there are 2 or 3 or even 4 events ..... i would like to determine if 2 events had time overlap from the mintime ' maxtime of each events if time of events don't overlap that we can exclude...so if time overlaps d with a I don't need the other events hope that helps</description>
      <pubDate>Tue, 09 Feb 2016 21:07:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-add-additional-rows-to-the-and-statements/m-p/249066#M56496</guid>
      <dc:creator>Beto16</dc:creator>
      <dc:date>2016-02-09T21:07:38Z</dc:date>
    </item>
  </channel>
</rss>

