<?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 three month rolling with trading data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-three-month-rolling-with-trading-data/m-p/436249#M282142</link>
    <description>&lt;P&gt;Given an average of 20 trading days per month and one observation per trading day, you want to multiply the size of your dataset by &lt;STRIKE&gt;60&lt;/STRIKE&gt; 3&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What do you want to do with the rolling windows?&amp;nbsp; If you are creating rolling window statistics&amp;nbsp; (i.e. one observation per rolling window, which is 5% of the original number of observations), then there are many ways to generate them without writing all that data to disk.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 12 Feb 2018 15:50:31 GMT</pubDate>
    <dc:creator>mkeintz</dc:creator>
    <dc:date>2018-02-12T15:50:31Z</dc:date>
    <item>
      <title>How to create three month rolling with trading data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-three-month-rolling-with-trading-data/m-p/436132#M282138</link>
      <description />
      <pubDate>Thu, 04 Jun 2020 00:52:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-three-month-rolling-with-trading-data/m-p/436132#M282138</guid>
      <dc:creator>trungcva112</dc:creator>
      <dc:date>2020-06-04T00:52:32Z</dc:date>
    </item>
    <item>
      <title>Re: three month roll</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-three-month-rolling-with-trading-data/m-p/436138#M282139</link>
      <description>&lt;P&gt;&lt;A href="https://communities.sas.com/t5/Base-SAS-Programming/standard-deviation-at-the-end-of-each-month-based-on-daily/m-p/436118" target="_blank"&gt;https://communities.sas.com/t5/Base-SAS-Programming/standard-deviation-at-the-end-of-each-month-based-on-daily/m-p/436118&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is 12 months and STD but you should be able to modify it for 3 months.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 03:40:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-three-month-rolling-with-trading-data/m-p/436138#M282139</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-02-12T03:40:43Z</dc:date>
    </item>
    <item>
      <title>Re: three month roll</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-three-month-rolling-with-trading-data/m-p/436166#M282140</link>
      <description>&lt;P&gt;Hi, it seems that this code could not produce my desired output. Do you have any other ideas?&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 08:47:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-three-month-rolling-with-trading-data/m-p/436166#M282140</guid>
      <dc:creator>trungcva112</dc:creator>
      <dc:date>2018-02-12T08:47:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to create three month rolling with trading data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-three-month-rolling-with-trading-data/m-p/436194#M282141</link>
      <description>&lt;P&gt;Here could give you a start.&lt;/P&gt;
&lt;P&gt;After running the following code, check the frequency of each window. I think it is easy for you .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile cards expandtabs truncover;
input Stocks $ date	: ddmmyy10. A	B;
format date	 ddmmyy10.;
cards;
ABC	01/04/2011	10	2
ABC	04/04/2011	11	5
ABC	05/04/2011	15	8
ABC	06/04/2011	17	4
ABC	28/04/2011	22	9
ABC	29/04/2011	36	10
ABC	02/05/2011	12	15
ABC	03/05/2011	15	11
XYZ	02/12/2010	6	16
XYZ	03/12/2010	6	18
XYZ	05/12/2010	6	20
XYZ	06/12/2010	6	21
XYZ	03/01/2011	8	12
XYZ	04/01/2011	8	5
XYZ	05/01/2011	8	8
XYZ	06/01/2011	8	9
;
run;
proc sql;
create table temp as
 select distinct stocks,year(date) as year,month(date) as month,
  mdy(calculated month,1,calculated year) as window format=mmyys7.,
  intnx('month',calculated window,-2) as start format=yymmdd10.,
  intnx('month',calculated window,0,'e') as end format=yymmdd10.
  from have;
  
create table want as
 select a.window,b.*
  from temp as a,have as b 
   where a.stocks=b.stocks and b.date between a.start and a.end;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Feb 2018 11:25:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-three-month-rolling-with-trading-data/m-p/436194#M282141</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-02-12T11:25:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to create three month rolling with trading data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-three-month-rolling-with-trading-data/m-p/436249#M282142</link>
      <description>&lt;P&gt;Given an average of 20 trading days per month and one observation per trading day, you want to multiply the size of your dataset by &lt;STRIKE&gt;60&lt;/STRIKE&gt; 3&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What do you want to do with the rolling windows?&amp;nbsp; If you are creating rolling window statistics&amp;nbsp; (i.e. one observation per rolling window, which is 5% of the original number of observations), then there are many ways to generate them without writing all that data to disk.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 15:50:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-three-month-rolling-with-trading-data/m-p/436249#M282142</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2018-02-12T15:50:31Z</dc:date>
    </item>
  </channel>
</rss>

