<?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: Sum in between every second in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Sum-in-between-every-second/m-p/486915#M287241</link>
    <description>&lt;P&gt;Couple of ways of doing it, you could assign a group (rather than 1-sec mark, increase it to 1 se, 2 sec etc.) then means by the group variable.&amp;nbsp; Or you could have a retained value in a datastep, e.g. (not tested, post test data in the form of a datastep in future):&lt;/P&gt;
&lt;PRE&gt;data want (drop=tot_trade);
  set have;
  by group;
  retain tot_trade;
  if first.group then tot_trade=0;
  if type="Trade" then tot_trade=sum(tot_trade,volume);
  if type="1-sec mark" and not first.group then do;
    volume=tot_trade;
    tot_trade=0;
  end;
run;&lt;/PRE&gt;</description>
    <pubDate>Wed, 15 Aug 2018 07:47:51 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2018-08-15T07:47:51Z</dc:date>
    <item>
      <title>Sum in between every second</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sum-in-between-every-second/m-p/486914#M287240</link>
      <description />
      <pubDate>Thu, 04 Jun 2020 00:53:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sum-in-between-every-second/m-p/486914#M287240</guid>
      <dc:creator>trungcva112</dc:creator>
      <dc:date>2020-06-04T00:53:14Z</dc:date>
    </item>
    <item>
      <title>Re: Sum in between every second</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sum-in-between-every-second/m-p/486915#M287241</link>
      <description>&lt;P&gt;Couple of ways of doing it, you could assign a group (rather than 1-sec mark, increase it to 1 se, 2 sec etc.) then means by the group variable.&amp;nbsp; Or you could have a retained value in a datastep, e.g. (not tested, post test data in the form of a datastep in future):&lt;/P&gt;
&lt;PRE&gt;data want (drop=tot_trade);
  set have;
  by group;
  retain tot_trade;
  if first.group then tot_trade=0;
  if type="Trade" then tot_trade=sum(tot_trade,volume);
  if type="1-sec mark" and not first.group then do;
    volume=tot_trade;
    tot_trade=0;
  end;
run;&lt;/PRE&gt;</description>
      <pubDate>Wed, 15 Aug 2018 07:47:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sum-in-between-every-second/m-p/486915#M287241</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-08-15T07:47:51Z</dc:date>
    </item>
  </channel>
</rss>

