<?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 remove first rows in a specific period of time? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-first-rows-in-a-specific-period-of-time/m-p/417201#M280333</link>
    <description>The interval is:&lt;BR /&gt;9:00:01 &amp;lt;= time &amp;lt;= 9:05:59</description>
    <pubDate>Wed, 29 Nov 2017 19:45:22 GMT</pubDate>
    <dc:creator>aminkarimid</dc:creator>
    <dc:date>2017-11-29T19:45:22Z</dc:date>
    <item>
      <title>How to remove first rows in a specific period of time?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-first-rows-in-a-specific-period-of-time/m-p/417172#M280330</link>
      <description>&lt;P&gt;Hello everybody,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table which has name, date and time variables. I want to do operation which is mentioned below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If &amp;nbsp;9:00:01 &amp;lt;= time &amp;lt;= 9:05:59 then delete the first row in the interval. If a time value of next rows is the&amp;nbsp;same with first row in this interval then delete all of them for that name and date variables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is an example of my data: &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data WORK.TABLEA;
infile datalines dsd truncover;
input name:$3. date:DATE9. time:TIME8.;
format date DATE9. time TIME8.;
label name="name" date="date" time="time";
datalines4;
A, 7-May-08, 09:01:41
A, 7-May-08, 09:01:41
A, 7-May-08, 09:04:41
A, 7-May-08, 11:32:41
A, 8-May-08, 09:06:00
A, 8-May-08, 09:06:01
A, 8-May-08, 12:32:41
B, 7-May-08, 09:00:01
B, 7-May-08, 09:00:01
B, 7-May-08, 11:33:41
B, 9-May-08, 09:05:59
B, 9-May-08, 11:35:41
B, 9-May-08, 11:36:41
B, 9-May-08, 11:37:41
B, 12-May-08, 11:27:41
B, 12-May-08, 11:27:41
;;;;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, the result is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;name&lt;/TD&gt;&lt;TD&gt;date&lt;/TD&gt;&lt;TD&gt;time&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;7-May-08&lt;/TD&gt;&lt;TD&gt;9:04:41&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;7-May-08&lt;/TD&gt;&lt;TD&gt;11:32:41&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;8-May-08&lt;/TD&gt;&lt;TD&gt;9:06:00&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;8-May-08&lt;/TD&gt;&lt;TD&gt;9:06:01&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;8-May-08&lt;/TD&gt;&lt;TD&gt;12:32:41&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;7-May-08&lt;/TD&gt;&lt;TD&gt;11:33:41&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;9-May-08&lt;/TD&gt;&lt;TD&gt;11:35:41&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;9-May-08&lt;/TD&gt;&lt;TD&gt;11:36:41&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;9-May-08&lt;/TD&gt;&lt;TD&gt;11:37:41&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;12-May-08&lt;/TD&gt;&lt;TD&gt;11:27:41&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;12-May-08&lt;/TD&gt;&lt;TD&gt;11:27:41&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I do that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2017 19:48:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-first-rows-in-a-specific-period-of-time/m-p/417172#M280330</guid>
      <dc:creator>aminkarimid</dc:creator>
      <dc:date>2017-11-29T19:48:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove first rows in a specific period of time?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-first-rows-in-a-specific-period-of-time/m-p/417173#M280331</link>
      <description>&lt;P&gt;You have pretty much written the code to do this in your text when you said&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;9:00:01 &amp;lt;= time &amp;lt;= 9:05:59&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;All you have to do is turn this into a proper IF statement.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2017 18:16:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-first-rows-in-a-specific-period-of-time/m-p/417173#M280331</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2017-11-29T18:16:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove first rows in a specific period of time?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-first-rows-in-a-specific-period-of-time/m-p/417174#M280332</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138303"&gt;@aminkarimid&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hello everybody,&lt;/P&gt;
&lt;P&gt;I want to do operation which is mentioned below:&lt;/P&gt;
&lt;P&gt;If &amp;nbsp;9:00:01 &amp;lt;= time &amp;lt;= 9:05:59 then delete the first row in the &lt;STRONG&gt;interval&lt;/STRONG&gt;. If a time value of next rows is the&amp;nbsp;same with first row in this &lt;STRONG&gt;interval&lt;/STRONG&gt; then delete all of them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What are you defining as an 'interval'? There's no interval variable or clear definition.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2017 18:20:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-first-rows-in-a-specific-period-of-time/m-p/417174#M280332</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-11-29T18:20:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove first rows in a specific period of time?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-first-rows-in-a-specific-period-of-time/m-p/417201#M280333</link>
      <description>The interval is:&lt;BR /&gt;9:00:01 &amp;lt;= time &amp;lt;= 9:05:59</description>
      <pubDate>Wed, 29 Nov 2017 19:45:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-first-rows-in-a-specific-period-of-time/m-p/417201#M280333</guid>
      <dc:creator>aminkarimid</dc:creator>
      <dc:date>2017-11-29T19:45:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove first rows in a specific period of time?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-first-rows-in-a-specific-period-of-time/m-p/417203#M280334</link>
      <description>&lt;P&gt;So that's a 6 minute range, is it for only that range&amp;nbsp;OR for multiple intervals of 6 minutes or just the last record each hour/6 minutes.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It sounds like you want to group that interval and then take the last value, where it's not duplicate?&amp;nbsp; Or just remove the first value? If the data was like this what would happen?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data WORK.TABLEA;
infile datalines dsd truncover;
input name:$3. date:DATE9. time:TIME8.;
format date DATE9. time TIME8.;
label name="name" date="date" time="time";
datalines4;
A, 7-May-08, 09:01:41
A, 7-May-08, 09:01:41
A, 7-May-08, 09:03:20
A, 7-May-08, 09:04:41
A, 7-May-08, 11:32:41
A, 8-May-08, 09:06:00
A, 8-May-08, 09:06:01
A, 8-May-08, 12:32:41
B, 7-May-08, 09:00:01
B, 7-May-08, 09:00:01
B, 7-May-08, 11:33:41
B, 9-May-08, 09:05:59
B, 9-May-08, 11:35:41
B, 9-May-08, 11:36:41
B, 9-May-08, 11:37:41
B, 12-May-08, 11:27:41
B, 12-May-08, 11:27:41
;;;;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2017 19:51:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-first-rows-in-a-specific-period-of-time/m-p/417203#M280334</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-11-29T19:51:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove first rows in a specific period of time?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-first-rows-in-a-specific-period-of-time/m-p/417204#M280335</link>
      <description>I don't know how to write the code which deletes next rows with the same time value with the first row in this interval. because "FIRST" statement just deletes the first observation.</description>
      <pubDate>Wed, 29 Nov 2017 19:54:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-first-rows-in-a-specific-period-of-time/m-p/417204#M280335</guid>
      <dc:creator>aminkarimid</dc:creator>
      <dc:date>2017-11-29T19:54:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove first rows in a specific period of time?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-first-rows-in-a-specific-period-of-time/m-p/417209#M280336</link>
      <description>&lt;P&gt;1- Yes, just 6 minutes (consider time interval which is shown above [9:00:01, 9:05:59] ).&lt;BR /&gt;2- No, If I group that interval then I want to delete first one. Because I'm working with high frequency data and there is more data into this interval with different time value.&lt;BR /&gt;3- So, the result will be what is shown in the question which the first group in this interval for any name and date is deleted.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2017 20:14:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-first-rows-in-a-specific-period-of-time/m-p/417209#M280336</guid>
      <dc:creator>aminkarimid</dc:creator>
      <dc:date>2017-11-29T20:14:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove first rows in a specific period of time?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-first-rows-in-a-specific-period-of-time/m-p/417213#M280337</link>
      <description>&lt;P&gt;&amp;nbsp;It's not the same data - I added a record.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2017 20:13:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-first-rows-in-a-specific-period-of-time/m-p/417213#M280337</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-11-29T20:13:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove first rows in a specific period of time?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-first-rows-in-a-specific-period-of-time/m-p/417219#M280338</link>
      <description>&lt;P&gt;Yes, I just found out.&lt;BR /&gt;So, based on what you added in data, for "A" and "7-May-08" date value, "09:01:41" and "09:01:41" should be deleted and observations, which is shown below, are retained.&lt;BR /&gt;A, 7-May-08, 09:03:20&lt;BR /&gt;A, 7-May-08, 09:04:41&lt;BR /&gt;A, 7-May-08, 11:32:41&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2017 20:28:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-first-rows-in-a-specific-period-of-time/m-p/417219#M280338</guid>
      <dc:creator>aminkarimid</dc:creator>
      <dc:date>2017-11-29T20:28:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove first rows in a specific period of time?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-first-rows-in-a-specific-period-of-time/m-p/417480#M280339</link>
      <description>&lt;P&gt;This works fine for me. Not sure if it will scale though, I'll leave the efficiency operation up to you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _temp;
set tableA;
by name date time;
where time between hms(9, 0, 1) and hms(9, 5, 59);
if first.date then counter=0;
if first.time then counter+1;
run;

proc sql;
create table tableB as
select * from tableA
except all  (select name, date, time from _temp where counter=1);
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 30 Nov 2017 17:19:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-first-rows-in-a-specific-period-of-time/m-p/417480#M280339</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-11-30T17:19:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove first rows in a specific period of time?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-remove-first-rows-in-a-specific-period-of-time/m-p/417565#M280340</link>
      <description>&lt;P&gt;&lt;A href="https://stackoverflow.com/questions/47577127/how-to-remove-a-first-row-or-first-group-of-rows-in-a-specific-time-interval-usi/47580344#47580344" target="_self"&gt;Based on&lt;/A&gt; &lt;A href="https://stackoverflow.com/users/8628395/petr" target="_blank"&gt;Petr&lt;/A&gt;'s code,&amp;nbsp;I think the better solution is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want as select *
from have
group by name, date
having min(time) not between '09:00:01't and '09:05:59't
    or time ne min(time)
;quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 30 Nov 2017 21:01:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-remove-first-rows-in-a-specific-period-of-time/m-p/417565#M280340</guid>
      <dc:creator>aminkarimid</dc:creator>
      <dc:date>2017-11-30T21:01:42Z</dc:date>
    </item>
  </channel>
</rss>

