<?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 can I create a table based on a readtime Column? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-can-I-create-a-table-based-on-a-readtime-Column/m-p/195795#M48984</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gergely,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi Thank you fro your reply!&amp;nbsp; Yes, as you described if there are 3 rows in the range, then yes, I want to keep all of them. The codes you mentioned below, I have think about this method by creating a new table with two extra columns as t1=time-29 and&amp;nbsp; t2=time-31. However, I didn't continue because I don't think you can join two tables without common variable. Your code just remind me that I can actually do cartesian join &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for the help again and I will try the code and see how it goes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tao &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 06 Mar 2015 13:57:11 GMT</pubDate>
    <dc:creator>yangtaotai</dc:creator>
    <dc:date>2015-03-06T13:57:11Z</dc:date>
    <item>
      <title>How can I create a table based on a readtime Column?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-can-I-create-a-table-based-on-a-readtime-Column/m-p/195792#M48981</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Everyone.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a table with a read time column and what I want to do is based on the read time column, if there are some early records with datetime value between current record’s readtime – 31*60 (readtime is a datetime. Format column) and readtime – 29*60, then keep the current record. Loop through from the first record to the last record in this table. (between 31 mins and 29 mins).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not sure how I can do this? seems like I need to a loop but just not sure how to check if there is a record between the time limit...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions and advice?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tao&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Mar 2015 04:29:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-can-I-create-a-table-based-on-a-readtime-Column/m-p/195792#M48981</guid>
      <dc:creator>yangtaotai</dc:creator>
      <dc:date>2015-03-06T04:29:28Z</dc:date>
    </item>
    <item>
      <title>Re: How can I create a table based on a readtime Column?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-can-I-create-a-table-based-on-a-readtime-Column/m-p/195793#M48982</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tao,&lt;/P&gt;&lt;P&gt;Could you post an example of data what you have, and what results you want?&lt;/P&gt;&lt;P&gt;What you describe is a self-join? For example, if there are 3 records within the 29-31 minute interval, you want 3 rows generated for the current row?&lt;/P&gt;&lt;P&gt;If I understand you correctly, you can do thin with an SQL self-join, or (if you have lots of records) after sorting the data set by time, you need one carefully written datastep to accomplish this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Mar 2015 09:39:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-can-I-create-a-table-based-on-a-readtime-Column/m-p/195793#M48982</guid>
      <dc:creator>gergely_batho</dc:creator>
      <dc:date>2015-03-06T09:39:27Z</dc:date>
    </item>
    <item>
      <title>Re: How can I create a table based on a readtime Column?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-can-I-create-a-table-based-on-a-readtime-Column/m-p/195794#M48983</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here's an SQL version. Of course, instead of (time-29) you need to use (time-29*60), or the intnx() function.&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;do id=1 to 1000;&lt;/P&gt;&lt;P&gt;&amp;nbsp; time+ranuni(123);&lt;/P&gt;&lt;P&gt;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; create table want as&lt;/P&gt;&lt;P&gt;&amp;nbsp; select l.id, l.time, r.id as id2, r.time as time2&lt;/P&gt;&lt;P&gt;&amp;nbsp; from have as l, have as r&lt;/P&gt;&lt;P&gt;&amp;nbsp; where r.time between l.time-29 and l.time-31;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Mar 2015 09:52:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-can-I-create-a-table-based-on-a-readtime-Column/m-p/195794#M48983</guid>
      <dc:creator>gergely_batho</dc:creator>
      <dc:date>2015-03-06T09:52:35Z</dc:date>
    </item>
    <item>
      <title>Re: How can I create a table based on a readtime Column?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-can-I-create-a-table-based-on-a-readtime-Column/m-p/195795#M48984</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gergely,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi Thank you fro your reply!&amp;nbsp; Yes, as you described if there are 3 rows in the range, then yes, I want to keep all of them. The codes you mentioned below, I have think about this method by creating a new table with two extra columns as t1=time-29 and&amp;nbsp; t2=time-31. However, I didn't continue because I don't think you can join two tables without common variable. Your code just remind me that I can actually do cartesian join &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for the help again and I will try the code and see how it goes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tao &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Mar 2015 13:57:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-can-I-create-a-table-based-on-a-readtime-Column/m-p/195795#M48984</guid>
      <dc:creator>yangtaotai</dc:creator>
      <dc:date>2015-03-06T13:57:11Z</dc:date>
    </item>
  </channel>
</rss>

