<?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: I have to merge 2 tables that fall within 0 to 2 min duration in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/I-have-to-merge-2-tables-that-fall-within-0-to-2-min-duration/m-p/273446#M58453</link>
    <description>I created alias to the 1st to table A ... still not working what do you think I'm doing wrong? Thanks for help</description>
    <pubDate>Thu, 26 May 2016 23:47:21 GMT</pubDate>
    <dc:creator>Beto16</dc:creator>
    <dc:date>2016-05-26T23:47:21Z</dc:date>
    <item>
      <title>I have to merge 2 tables that fall within 0 to 2 min duration</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/I-have-to-merge-2-tables-that-fall-within-0-to-2-min-duration/m-p/273401#M58445</link>
      <description>&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I have table that shows when machine was rebooted which eq action code key xy and when it was service action code key gh col of table&lt;BR /&gt;id&lt;BR /&gt;key,&lt;BR /&gt;action key&lt;BR /&gt;start date dt&lt;BR /&gt;End date dt&lt;BR /&gt;time duration&lt;BR /&gt;&lt;BR /&gt;What I need is to determine is when there was an action key xy was there a action code key gh.. thst falls within 0 to 2 min if yes create dataset if action key eq xy and no gh within 0 tO 2 min create data setb for it ..data looks like this&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;BR /&gt;Id. Key. Action key start date dt. End date dt dur&lt;BR /&gt;A1 40 Gh 25 may 2016;00:01:00 25 may 2016;05:00. 4 min duration&lt;BR /&gt;A1 34. Xy 25 may 2016;00:02:00 25 may 2016;00:18:00. 17 min duration&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I want a dataset where start from xy an gh falls within 2 min&lt;BR /&gt;&lt;BR /&gt;Id. Key. Action key start date dt. End date dt dur&lt;BR /&gt;A1 40 Gh 25 may 2016;00:01:00 25 may 2016;05:00. 4 min duration&lt;BR /&gt;A1 34. Xy 25 may 2016;00:08:00 25 may 2016;00:18:00. 10 min duration&lt;BR /&gt;&lt;BR /&gt;and a dataset of xy where gh didn't overlap 2 min&lt;BR /&gt;&lt;BR /&gt;thank you again In the bottom I was tinkering with it but running circles lol&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;oc sql;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; create table overlap as&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select a.site_id, a.machine as a_machine, ....&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from log_tbl as A, log_tbl as B&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where a.site_id=b.site_id and a.start_dttm&amp;lt;b.start_dttm and a.end_dttm&amp;gt;b.start_dttm&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;BR /&gt;&lt;BR /&gt;quit;&lt;BR /&gt;</description>
      <pubDate>Thu, 26 May 2016 21:07:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/I-have-to-merge-2-tables-that-fall-within-0-to-2-min-duration/m-p/273401#M58445</guid>
      <dc:creator>Beto16</dc:creator>
      <dc:date>2016-05-26T21:07:00Z</dc:date>
    </item>
    <item>
      <title>Re: I have to merge 2 tables that fall within 0 to 2 min duration</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/I-have-to-merge-2-tables-that-fall-within-0-to-2-min-duration/m-p/273417#M58447</link>
      <description>&lt;P&gt;First thing: Are your datetime values actual SAS datetime valued or are they character values that just look like datetime?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think you may want to change this:&lt;/P&gt;
&lt;P&gt;from log_tbl as A to from (select * from log_tbl where action = 'Xy') as a&lt;/P&gt;
&lt;P&gt;to get the Xy records and similarly&lt;/P&gt;
&lt;P&gt;log_tbl as B&lt;/P&gt;
&lt;P&gt;would be (select * from log_tbl where action='Gh') as b&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might try, for better reading:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instead of: and&amp;nbsp;a.start_dttm&amp;lt;b.start_dttm and a.end_dttm&amp;gt;b.start_dttm&lt;/P&gt;
&lt;P&gt;try&lt;/P&gt;
&lt;P&gt;and b.start_dttm between a.start_dttm and a.end_dttm&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2016 21:38:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/I-have-to-merge-2-tables-that-fall-within-0-to-2-min-duration/m-p/273417#M58447</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-05-26T21:38:53Z</dc:date>
    </item>
    <item>
      <title>Re: I have to merge 2 tables that fall within 0 to 2 min duration</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/I-have-to-merge-2-tables-that-fall-within-0-to-2-min-duration/m-p/273431#M58449</link>
      <description>It's a datetime sas format. .. where do I make refer on the 0-2 min duration which the service = Gh is within 0-2 mind from xy ? Thanks for assisting</description>
      <pubDate>Thu, 26 May 2016 22:17:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/I-have-to-merge-2-tables-that-fall-within-0-to-2-min-duration/m-p/273431#M58449</guid>
      <dc:creator>Beto16</dc:creator>
      <dc:date>2016-05-26T22:17:36Z</dc:date>
    </item>
    <item>
      <title>Re: I have to merge 2 tables that fall within 0 to 2 min duration</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/I-have-to-merge-2-tables-that-fall-within-0-to-2-min-duration/m-p/273435#M58450</link>
      <description>&lt;P&gt;I think you need to provide some more complete example of actual match and not match. I can't tell within 2 minutes of what from your description. You have starttime and endtime on boths sides. Is it supposed to be within 2 minutes of either start or end from A or only within 2 minutes after start or 2 minutes before end or is it okay to be more than 2 minutes from either if the interval between start and end exceeds 4 minutes.&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2016 22:43:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/I-have-to-merge-2-tables-that-fall-within-0-to-2-min-duration/m-p/273435#M58450</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-05-26T22:43:40Z</dc:date>
    </item>
    <item>
      <title>Re: I have to merge 2 tables that fall within 0 to 2 min duration</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/I-have-to-merge-2-tables-that-fall-within-0-to-2-min-duration/m-p/273440#M58451</link>
      <description>Ok I have this&lt;BR /&gt;Proc sql;&lt;BR /&gt;Create table overlapping as&lt;BR /&gt;(Select&lt;BR /&gt;Id,&lt;BR /&gt;action key,&lt;BR /&gt;start date dt,&lt;BR /&gt;End date dt&lt;BR /&gt;From (select*from table where action code key ='xy')as A&lt;BR /&gt;&lt;BR /&gt;From (select*from table where action code key ='Gh')as b&lt;BR /&gt;&lt;BR /&gt;and b.start_date between a.start_date and a.end_date&lt;BR /&gt;);&lt;BR /&gt;Run;&lt;BR /&gt;&lt;BR /&gt;I get error on the asterisks&lt;BR /&gt;22_76 syntax error , expecting one of the following : ),', ' .... the duration time should be starttime of gh and start time of xy if it falls with 0 to 2 min that create data set if it's greater than 2 min that create differ dataset. Thanks</description>
      <pubDate>Thu, 26 May 2016 23:11:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/I-have-to-merge-2-tables-that-fall-within-0-to-2-min-duration/m-p/273440#M58451</guid>
      <dc:creator>Beto16</dc:creator>
      <dc:date>2016-05-26T23:11:02Z</dc:date>
    </item>
    <item>
      <title>Re: I have to merge 2 tables that fall within 0 to 2 min duration</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/I-have-to-merge-2-tables-that-fall-within-0-to-2-min-duration/m-p/273441#M58452</link>
      <description>I think I fixed error but now I'm getting&lt;BR /&gt;ambiguous reference column action code key is more than one table&lt;BR /&gt;ambiguous reference column start date is more than one table</description>
      <pubDate>Thu, 26 May 2016 23:18:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/I-have-to-merge-2-tables-that-fall-within-0-to-2-min-duration/m-p/273441#M58452</guid>
      <dc:creator>Beto16</dc:creator>
      <dc:date>2016-05-26T23:18:32Z</dc:date>
    </item>
    <item>
      <title>Re: I have to merge 2 tables that fall within 0 to 2 min duration</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/I-have-to-merge-2-tables-that-fall-within-0-to-2-min-duration/m-p/273446#M58453</link>
      <description>I created alias to the 1st to table A ... still not working what do you think I'm doing wrong? Thanks for help</description>
      <pubDate>Thu, 26 May 2016 23:47:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/I-have-to-merge-2-tables-that-fall-within-0-to-2-min-duration/m-p/273446#M58453</guid>
      <dc:creator>Beto16</dc:creator>
      <dc:date>2016-05-26T23:47:21Z</dc:date>
    </item>
    <item>
      <title>Re: I have to merge 2 tables that fall within 0 to 2 min duration</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/I-have-to-merge-2-tables-that-fall-within-0-to-2-min-duration/m-p/273463#M58455</link>
      <description>Here is example of what I'm working with&lt;BR /&gt;Id. Key. Action key start date dt. End date dt dur&lt;BR /&gt;A1 40 Gh 25 may 2016;00:01:00 25 may 2016;05:00. 4 min duration&lt;BR /&gt;A1 34. Xy 25 may 2016;00:02:00 25 may 2016;00:18:00. 16 min duration&lt;BR /&gt;this example shows that first gh had within range of 2 min&lt;BR /&gt;I would that in a dataset as overlap if I have&lt;BR /&gt;&lt;BR /&gt;Id. Key. Action key start date dt. End date dt dur&lt;BR /&gt;A1 40 Gh 25 may 2016;00:01:00 25 may 2016;05:00. 4 min duration&lt;BR /&gt;A1 34. Xy 25 may 2016;00:08:00 25 may 2016;00:18:00. 10 min duration&lt;BR /&gt;On this example the first gh an first xy start time is greater than 2 min so this example I would like a dataset named no overlap thank you again hope this helps&lt;BR /&gt;</description>
      <pubDate>Fri, 27 May 2016 02:05:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/I-have-to-merge-2-tables-that-fall-within-0-to-2-min-duration/m-p/273463#M58455</guid>
      <dc:creator>Beto16</dc:creator>
      <dc:date>2016-05-27T02:05:45Z</dc:date>
    </item>
    <item>
      <title>Re: I have to merge 2 tables that fall within 0 to 2 min duration</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/I-have-to-merge-2-tables-that-fall-within-0-to-2-min-duration/m-p/273615#M58460</link>
      <description>Thanks for assistance im still in process of tweaking the code .. I will post better examples next time</description>
      <pubDate>Fri, 27 May 2016 15:28:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/I-have-to-merge-2-tables-that-fall-within-0-to-2-min-duration/m-p/273615#M58460</guid>
      <dc:creator>Beto16</dc:creator>
      <dc:date>2016-05-27T15:28:37Z</dc:date>
    </item>
  </channel>
</rss>

