<?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 create an extra row after the last row of each BY group? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-an-extra-row-after-the-last-row-of-each-BY-group/m-p/697552#M213196</link>
    <description>&lt;P&gt;Ok, just needed the structure. Here, I created a very simple replica of your tradingdays data set. It is just the day after the last date for each atock in sashelp.stocks.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See if it works for you&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data tradingdays;
input begin :ddmmyy10.;
format begin ddmmyy10.;
datalines;
02/08/1986
run;


data want(drop=begin);

   dcl hash h(dataset : "tradingdays(rename=begin=date)");
   h.definekey("date");
   h.definedone();

   do until (last.stock);
      set sashelp.stocks;
      by stock;
      output;
   end;

   do until (h.check());
      date + 1;
   end;
   
   output;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 09 Nov 2020 09:55:14 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2020-11-09T09:55:14Z</dc:date>
    <item>
      <title>How to create an extra row after the last row of each BY group?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-an-extra-row-after-the-last-row-of-each-BY-group/m-p/697542#M213190</link>
      <description>&lt;P&gt;I have a stock dataset. I would like to create 1 extra row, which is the date, after the last date of the stock in the dataset. So for example, my dataset contains prices for stock IBM from 20190102 until 20190630. I want to create 1 extra row for the date 20190701.&amp;nbsp; One extra requirement is that it cannot be a holiday, i.e. It has to be a business date.&lt;/P&gt;
&lt;P&gt;I have a dataset called TRADINGDAYS that has 1 column of dates that are business dates. it looks like this. The dataset is attached&lt;/P&gt;
&lt;PRE&gt;Begin&amp;nbsp;
20190102
20190103
......
20191230&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Nov 2020 09:38:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-an-extra-row-after-the-last-row-of-each-BY-group/m-p/697542#M213190</guid>
      <dc:creator>somebody</dc:creator>
      <dc:date>2020-11-09T09:38:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to create an extra row after the last row of each BY group?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-an-extra-row-after-the-last-row-of-each-BY-group/m-p/697543#M213191</link>
      <description>&lt;P&gt;The easy part can be solved like this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Post your tradingdays data if you want that included as well&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   do until (last.stock);
      set sashelp.stocks;
      by stock;
      output;
   end;
   date + 1;
   output;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Nov 2020 09:00:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-an-extra-row-after-the-last-row-of-each-BY-group/m-p/697543#M213191</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-11-09T09:00:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to create an extra row after the last row of each BY group?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-an-extra-row-after-the-last-row-of-each-BY-group/m-p/697549#M213194</link>
      <description>&lt;P&gt;Thanks. I edited my question and attached the tradingdays dataset. can you please have a look and incorporate that ?&lt;/P&gt;</description>
      <pubDate>Mon, 09 Nov 2020 09:39:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-an-extra-row-after-the-last-row-of-each-BY-group/m-p/697549#M213194</guid>
      <dc:creator>somebody</dc:creator>
      <dc:date>2020-11-09T09:39:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to create an extra row after the last row of each BY group?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-an-extra-row-after-the-last-row-of-each-BY-group/m-p/697552#M213196</link>
      <description>&lt;P&gt;Ok, just needed the structure. Here, I created a very simple replica of your tradingdays data set. It is just the day after the last date for each atock in sashelp.stocks.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See if it works for you&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data tradingdays;
input begin :ddmmyy10.;
format begin ddmmyy10.;
datalines;
02/08/1986
run;


data want(drop=begin);

   dcl hash h(dataset : "tradingdays(rename=begin=date)");
   h.definekey("date");
   h.definedone();

   do until (last.stock);
      set sashelp.stocks;
      by stock;
      output;
   end;

   do until (h.check());
      date + 1;
   end;
   
   output;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Nov 2020 09:55:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-an-extra-row-after-the-last-row-of-each-BY-group/m-p/697552#M213196</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-11-09T09:55:14Z</dc:date>
    </item>
  </channel>
</rss>

