<?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 the first 3 seconds and last 3 seconds of a measurement in SAS? in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-the-first-3-seconds-and-last-3-seconds-of-a/m-p/699086#M37583</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/310659"&gt;@AK100&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If performance is an issue, you may want to try a single-pass solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;EDIT:&lt;/STRONG&gt; The code below counts &lt;EM&gt;observations&lt;/EM&gt;, not &lt;EM&gt;seconds&lt;/EM&gt;. Assuming that the first 3 seconds correspond to &lt;FONT face="courier new,courier"&gt;0&amp;lt;=DateTime&amp;lt;=3&lt;/FONT&gt; (although these don't seem to be SAS datetime values), this could be adapted, but without a known end time the definition of the "last 3 seconds" seems doubtful to me.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want(drop=_:);
do _i=1 by 1 until(last.id);
  set have;
  by id;
  if _i&amp;gt;3 then do; /* conditional only for performance improvement */
    _v=lag2(value);
    _dt=lag2(datetime);
  end;
  if _i&amp;gt;5 &amp;amp; last.id=0 then do;
    value=_v;
    datetime=_dt;
    output;
  end;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 16 Nov 2020 12:36:11 GMT</pubDate>
    <dc:creator>FreelanceReinh</dc:creator>
    <dc:date>2020-11-16T12:36:11Z</dc:date>
    <item>
      <title>How to remove the first 3 seconds and last 3 seconds of a measurement in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-the-first-3-seconds-and-last-3-seconds-of-a/m-p/699065#M37570</link>
      <description>&lt;P&gt;Hello Guys,|&lt;BR /&gt;&lt;BR /&gt;Simple question. I have a dataset which looks like below (in reality much bigger). I want to remove the first 3 seconds and the last 3 seconds of every measurement. How can that easily be done?&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Value&amp;nbsp; &amp;nbsp;-&amp;nbsp; &amp;nbsp;DateTime&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;nbsp; &amp;nbsp; 0.0&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;15&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;nbsp; &amp;nbsp; 1.5&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;74&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-&amp;nbsp; &amp;nbsp; &amp;nbsp;2.2&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;19&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-&amp;nbsp; &amp;nbsp; 3.1&lt;/P&gt;
&lt;P&gt;13&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-&amp;nbsp; &amp;nbsp; 4.2&lt;/P&gt;
&lt;P&gt;71&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-&amp;nbsp; &amp;nbsp; &amp;nbsp;4.9&lt;/P&gt;
&lt;P&gt;40&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-&amp;nbsp; &amp;nbsp; 5.6&lt;/P&gt;
&lt;P&gt;31&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-&amp;nbsp; &amp;nbsp; 6.8&lt;/P&gt;
&lt;P&gt;87&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;nbsp; &amp;nbsp; &amp;nbsp;7.8&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;10&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-&amp;nbsp; &amp;nbsp; 8.4&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;11&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-&amp;nbsp; &amp;nbsp; 9.3&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;47&amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;nbsp; &amp;nbsp;10.1&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;9&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-&amp;nbsp; &amp;nbsp; 0.0&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;11&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-&amp;nbsp; &amp;nbsp; 0.9&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;7&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;nbsp; &amp;nbsp; &amp;nbsp;1.9&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;10&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-&amp;nbsp; &amp;nbsp; 2.8&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;11&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-&amp;nbsp; &amp;nbsp; 4.5&lt;/P&gt;
&lt;P&gt;74&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-&amp;nbsp; &amp;nbsp; &amp;nbsp;5.2&lt;/P&gt;
&lt;P&gt;10&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-&amp;nbsp; &amp;nbsp; 6.6&lt;/P&gt;
&lt;P&gt;11&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-&amp;nbsp; &amp;nbsp; 7.1&lt;/P&gt;
&lt;P&gt;71&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-&amp;nbsp; &amp;nbsp; &amp;nbsp;7.8&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;80&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-&amp;nbsp; &amp;nbsp; 8.9&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;16&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-&amp;nbsp; &amp;nbsp; 9.9&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;15&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;nbsp; &amp;nbsp; &amp;nbsp;10.9&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;So I actually want the BOLD ones removed.. Would like to hear. Thank you&lt;/P&gt;</description>
      <pubDate>Mon, 16 Nov 2020 08:46:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-the-first-3-seconds-and-last-3-seconds-of-a/m-p/699065#M37570</guid>
      <dc:creator>AK100</dc:creator>
      <dc:date>2020-11-16T08:46:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove the first 3 seconds and last 3 seconds of a measurement in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-the-first-3-seconds-and-last-3-seconds-of-a/m-p/699066#M37571</link>
      <description>&lt;P&gt;Why the first 4 in the second measurement?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you have an ID for each of your measurements?&lt;/P&gt;</description>
      <pubDate>Mon, 16 Nov 2020 08:50:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-the-first-3-seconds-and-last-3-seconds-of-a/m-p/699066#M37571</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-11-16T08:50:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove the first 3 seconds and last 3 seconds of a measurement in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-the-first-3-seconds-and-last-3-seconds-of-a/m-p/699068#M37573</link>
      <description>&lt;P&gt;I need the first and last 3 seconds removed because don't actually add something. The client doesn't need them. Yes, I forgot to say but they also have an ID yes. So record 1 till 12 have the same ID record 13 till 24 to etc..&lt;/P&gt;</description>
      <pubDate>Mon, 16 Nov 2020 08:59:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-the-first-3-seconds-and-last-3-seconds-of-a/m-p/699068#M37573</guid>
      <dc:creator>AK100</dc:creator>
      <dc:date>2020-11-16T08:59:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove the first 3 seconds and last 3 seconds of a measurement in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-the-first-3-seconds-and-last-3-seconds-of-a/m-p/699069#M37574</link>
      <description>&lt;P&gt;Ok. Do all IDs have 12 observations exactly?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Nov 2020 09:08:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-the-first-3-seconds-and-last-3-seconds-of-a/m-p/699069#M37574</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-11-16T09:08:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove the first 3 seconds and last 3 seconds of a measurement in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-the-first-3-seconds-and-last-3-seconds-of-a/m-p/699070#M37575</link>
      <description>&lt;P&gt;Use a double DO loop. In the first loop, record first and last time. In the second loop, only OUTPUT when time is between start + 3 and end - 3.&lt;/P&gt;
&lt;P&gt;For code, provide data in usable form.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Nov 2020 09:09:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-the-first-3-seconds-and-last-3-seconds-of-a/m-p/699070#M37575</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-11-16T09:09:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove the first 3 seconds and last 3 seconds of a measurement in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-the-first-3-seconds-and-last-3-seconds-of-a/m-p/699071#M37576</link>
      <description>&lt;P&gt;If so, you can do it in a single pass:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input ID Value DateTime;
datalines;
1 5 0.0
1 15 1.5
1 74 2.2
1 19 3.1
1 13 4.2
1 71 4.9
1 40 5.6
1 31 6.8
1 87 7.8
1 10 8.4
1 11 9.3
1 47 10.1
2 9 0.0
2 11 0.9
2 7 1.9
2 10 2.8
2 11 4.5
2 74 5.2
2 10 6.6
2 11 7.1
2 71 7.8
2 80 8.9
2 16 9.9
2 15 10.9
;

data want;
   do _N_ = 1 by 1 until (last.ID);
      set have;
      by ID;
      if _N_ not in (1:3, 10:12) then output;
   end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 16 Nov 2020 09:10:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-the-first-3-seconds-and-last-3-seconds-of-a/m-p/699071#M37576</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-11-16T09:10:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove the first 3 seconds and last 3 seconds of a measurement in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-the-first-3-seconds-and-last-3-seconds-of-a/m-p/699072#M37577</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304"&gt;@PeterClemmensen&lt;/a&gt;&amp;nbsp;No they don't all have 12 observations.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Nov 2020 09:21:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-the-first-3-seconds-and-last-3-seconds-of-a/m-p/699072#M37577</guid>
      <dc:creator>AK100</dc:creator>
      <dc:date>2020-11-16T09:21:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove the first 3 seconds and last 3 seconds of a measurement in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-the-first-3-seconds-and-last-3-seconds-of-a/m-p/699073#M37578</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;See usable data below:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE class="language-sas"&gt;&lt;CODE&gt;data have;
input ID Value DateTime;
datalines;
1 5 0.0
1 15 1.5
1 74 2.2
1 19 3.1
1 13 4.2
1 71 4.9
1 40 5.6
1 31 6.8
1 87 7.8
1 10 8.4
1 11 9.3
1 47 10.1
2 9 0.0
2 11 0.9
2 7 1.9
2 10 2.8
2 11 4.5
2 74 5.2
2 10 6.6
2 11 7.1
2 71 7.8
2 80 8.9
2 16 9.9
2 15 10.9
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Please note that not every measurements has 12 observations.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Nov 2020 09:19:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-the-first-3-seconds-and-last-3-seconds-of-a/m-p/699073#M37578</guid>
      <dc:creator>AK100</dc:creator>
      <dc:date>2020-11-16T09:19:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove the first 3 seconds and last 3 seconds of a measurement in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-the-first-3-seconds-and-last-3-seconds-of-a/m-p/699075#M37579</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want(drop=i j);
   do i = 1 by 1 until (last.ID);
      set have;
      by ID;
   end;
   do j = 1 by 1 until (last.ID);
      set have;
      by ID;
      if 3 &amp;lt; j &amp;lt; i-2 then output;
   end;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;ID  Value DateTime 
1   19    3.1 
1   13    4.2 
1   71    4.9 
1   40    5.6 
1   31    6.8 
1   87    7.8 
2   10    2.8 
2   11    4.5 
2   74    5.2 
2   10    6.6 
2   11    7.1 
2   71    7.8 
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Nov 2020 09:29:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-the-first-3-seconds-and-last-3-seconds-of-a/m-p/699075#M37579</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-11-16T09:29:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove the first 3 seconds and last 3 seconds of a measurement in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-the-first-3-seconds-and-last-3-seconds-of-a/m-p/699076#M37580</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
do until (last.id);
  set have;
  by id;
  if first.id then start = datetime;
  if last.id then end = datetime;
end;
do until (last.id);
  set have;
  by id;
  if start + 3 le datetime le end - 3 then output;
end;
drop start end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 16 Nov 2020 09:30:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-the-first-3-seconds-and-last-3-seconds-of-a/m-p/699076#M37580</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-11-16T09:30:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove the first 3 seconds and last 3 seconds of a measurement in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-the-first-3-seconds-and-last-3-seconds-of-a/m-p/699080#M37581</link>
      <description>Thank you. I will check it</description>
      <pubDate>Mon, 16 Nov 2020 09:57:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-the-first-3-seconds-and-last-3-seconds-of-a/m-p/699080#M37581</guid>
      <dc:creator>AK100</dc:creator>
      <dc:date>2020-11-16T09:57:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove the first 3 seconds and last 3 seconds of a measurement in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-the-first-3-seconds-and-last-3-seconds-of-a/m-p/699081#M37582</link>
      <description>&lt;P&gt;Thank you. I will check it.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Nov 2020 09:58:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-the-first-3-seconds-and-last-3-seconds-of-a/m-p/699081#M37582</guid>
      <dc:creator>AK100</dc:creator>
      <dc:date>2020-11-16T09:58:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove the first 3 seconds and last 3 seconds of a measurement in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-the-first-3-seconds-and-last-3-seconds-of-a/m-p/699086#M37583</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/310659"&gt;@AK100&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If performance is an issue, you may want to try a single-pass solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;EDIT:&lt;/STRONG&gt; The code below counts &lt;EM&gt;observations&lt;/EM&gt;, not &lt;EM&gt;seconds&lt;/EM&gt;. Assuming that the first 3 seconds correspond to &lt;FONT face="courier new,courier"&gt;0&amp;lt;=DateTime&amp;lt;=3&lt;/FONT&gt; (although these don't seem to be SAS datetime values), this could be adapted, but without a known end time the definition of the "last 3 seconds" seems doubtful to me.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want(drop=_:);
do _i=1 by 1 until(last.id);
  set have;
  by id;
  if _i&amp;gt;3 then do; /* conditional only for performance improvement */
    _v=lag2(value);
    _dt=lag2(datetime);
  end;
  if _i&amp;gt;5 &amp;amp; last.id=0 then do;
    value=_v;
    datetime=_dt;
    output;
  end;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Nov 2020 12:36:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-the-first-3-seconds-and-last-3-seconds-of-a/m-p/699086#M37583</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2020-11-16T12:36:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove the first 3 seconds and last 3 seconds of a measurement in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-the-first-3-seconds-and-last-3-seconds-of-a/m-p/699087#M37584</link>
      <description>@FreelanceReinhard. &lt;BR /&gt;&lt;BR /&gt;So this is the same as above, but much faster?</description>
      <pubDate>Mon, 16 Nov 2020 10:22:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-the-first-3-seconds-and-last-3-seconds-of-a/m-p/699087#M37584</guid>
      <dc:creator>AK100</dc:creator>
      <dc:date>2020-11-16T10:22:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove the first 3 seconds and last 3 seconds of a measurement in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-the-first-3-seconds-and-last-3-seconds-of-a/m-p/699088#M37585</link>
      <description>&lt;P&gt;The result is the same (EDIT: as obtained with&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-the-first-3-seconds-and-last-3-seconds-of-a/m-p/699075/highlight/true#M37579" target="_blank" rel="noopener"&gt;draycut's solution&lt;/A&gt;), but the code should run somewhat faster -- &lt;EM&gt;how much&lt;/EM&gt; faster depends, as usual, on hardware and software conditions, but also on the data (here, for example: the distribution of the number of observations per ID).&lt;/P&gt;</description>
      <pubDate>Mon, 16 Nov 2020 13:31:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-the-first-3-seconds-and-last-3-seconds-of-a/m-p/699088#M37585</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2020-11-16T13:31:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove the first 3 seconds and last 3 seconds of a measurement in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-the-first-3-seconds-and-last-3-seconds-of-a/m-p/699147#M37587</link>
      <description>Where does the 5 stand for in your code?</description>
      <pubDate>Mon, 16 Nov 2020 14:08:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-the-first-3-seconds-and-last-3-seconds-of-a/m-p/699147#M37587</guid>
      <dc:creator>AK100</dc:creator>
      <dc:date>2020-11-16T14:08:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove the first 3 seconds and last 3 seconds of a measurement in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-the-first-3-seconds-and-last-3-seconds-of-a/m-p/699152#M37588</link>
      <description>&lt;P&gt;The LAG2 values in the 5th observation of an ID would come from the 3rd observation (because 5-2=3), hence would not qualify for output if the first three &lt;EM&gt;observations&lt;/EM&gt; are to be excluded. Therefore, &lt;FONT face="courier new,courier"&gt;_i&amp;gt;5&lt;/FONT&gt; is a necessary condition for the OUTPUT statement to be executed.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Nov 2020 14:25:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-the-first-3-seconds-and-last-3-seconds-of-a/m-p/699152#M37588</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2020-11-16T14:25:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove the first 3 seconds and last 3 seconds of a measurement in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-the-first-3-seconds-and-last-3-seconds-of-a/m-p/699179#M37590</link>
      <description>@FreelanceReinhard. So what if I wanted to remove the first and last 8 seconds.</description>
      <pubDate>Mon, 16 Nov 2020 15:04:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-the-first-3-seconds-and-last-3-seconds-of-a/m-p/699179#M37590</guid>
      <dc:creator>AK100</dc:creator>
      <dc:date>2020-11-16T15:04:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove the first 3 seconds and last 3 seconds of a measurement in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-the-first-3-seconds-and-last-3-seconds-of-a/m-p/699185#M37591</link>
      <description>&lt;P&gt;Then you'd change the IF conditions and the length of the LAG queues as follows:&lt;/P&gt;
&lt;PRE&gt;...
  if _i&amp;gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;8&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt; then do; /* conditional only for performance improvement */
    _v=lag&lt;FONT size="4"&gt;&lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;7&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;(value);
    _dt=lag&lt;FONT size="4"&gt;&lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;7&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;(datetime);
  end;
  if _i&amp;gt;&lt;STRONG&gt;&lt;FONT size="4" color="#3366FF"&gt;15&lt;/FONT&gt;&lt;/STRONG&gt; &amp;amp; last.id=0 then do;
...&lt;/PRE&gt;
&lt;P&gt;To make the code flexible, you could use macro expressions involving a macro variable, say, &lt;FONT face="courier new,courier"&gt;d=8&lt;/FONT&gt;, in these four places. But, again, this code doesn't care for &lt;EM&gt;seconds&lt;/EM&gt;, only for &lt;EM&gt;observations&lt;/EM&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Nov 2020 15:16:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-the-first-3-seconds-and-last-3-seconds-of-a/m-p/699185#M37591</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2020-11-16T15:16:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove the first 3 seconds and last 3 seconds of a measurement in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-the-first-3-seconds-and-last-3-seconds-of-a/m-p/699196#M37592</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/310659"&gt;@AK100&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;@FreelanceReinhard. So what if I wanted to remove the first and last 8 seconds.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Are we talking about&amp;nbsp;&lt;EM&gt;seconds&amp;nbsp;&lt;/EM&gt;here or &lt;EM&gt;measurements (observations)&lt;/EM&gt;?&lt;/P&gt;</description>
      <pubDate>Mon, 16 Nov 2020 16:02:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-remove-the-first-3-seconds-and-last-3-seconds-of-a/m-p/699196#M37592</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-11-16T16:02:36Z</dc:date>
    </item>
  </channel>
</rss>

