<?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 Creating a 5 month rolling average - vertically or horizontally (observations or variables) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-5-month-rolling-average-vertically-or-horizontally/m-p/495744#M130907</link>
    <description>&lt;P&gt;I have a data set with 3 variables:&lt;/P&gt;&lt;P&gt;1. Regions - a list of 20&lt;/P&gt;&lt;P&gt;2. Months - the data set has one entry per region per calendar month starting in 2001&lt;/P&gt;&lt;P&gt;3. Index Rate - Each Region each month has one&amp;nbsp;index rate.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Instead of using the index rate per month per region, I need to use instead an average of the index rate from the previous two months and the next two months within the data set.&lt;/P&gt;&lt;P&gt;E.g.&lt;/P&gt;&lt;P&gt;For the Region London for March 2017 I need to assign that month not the index rate that is applicable for March 2017, but an average number for the index rates I have for Jan, Feb, March, April and May 2017.&lt;/P&gt;&lt;P&gt;For April 2017 I would need Feb to June 2017, and so forth.&lt;/P&gt;&lt;P&gt;As I get close to the present and I do not have 2 months in the future I will use the last month's index rate one or twice (i.e. for August 2018 I need to use Jule, August and Sept 3 times).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can do this&amp;nbsp;vertically (i.e. a simple 3 column data set - and then i would need to go up and down the month range) - or if I transpose the data - then with Region on the left column and months as the top headers - it will be horizontally.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The data looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;Region_Name&lt;/TD&gt;&lt;TD&gt;Index&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/01/2016&lt;/TD&gt;&lt;TD&gt;City of London&lt;/TD&gt;&lt;TD&gt;94.01813825&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/02/2016&lt;/TD&gt;&lt;TD&gt;City of London&lt;/TD&gt;&lt;TD&gt;97.70019819&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/03/2016&lt;/TD&gt;&lt;TD&gt;City of London&lt;/TD&gt;&lt;TD&gt;101.4148808&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/04/2016&lt;/TD&gt;&lt;TD&gt;City of London&lt;/TD&gt;&lt;TD&gt;102.7631184&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/05/2016&lt;/TD&gt;&lt;TD&gt;City of London&lt;/TD&gt;&lt;TD&gt;107.900446&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/06/2016&lt;/TD&gt;&lt;TD&gt;City of London&lt;/TD&gt;&lt;TD&gt;115.8611285&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/07/2016&lt;/TD&gt;&lt;TD&gt;City of London&lt;/TD&gt;&lt;TD&gt;116.3539602&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/08/2016&lt;/TD&gt;&lt;TD&gt;City of London&lt;/TD&gt;&lt;TD&gt;108.2436922&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/09/2016&lt;/TD&gt;&lt;TD&gt;City of London&lt;/TD&gt;&lt;TD&gt;99.59944053&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/10/2016&lt;/TD&gt;&lt;TD&gt;City of London&lt;/TD&gt;&lt;TD&gt;101.1481822&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/11/2016&lt;/TD&gt;&lt;TD&gt;City of London&lt;/TD&gt;&lt;TD&gt;104.4657271&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/12/2016&lt;/TD&gt;&lt;TD&gt;City of London&lt;/TD&gt;&lt;TD&gt;103.5881838&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/01/2017&lt;/TD&gt;&lt;TD&gt;City of London&lt;/TD&gt;&lt;TD&gt;104.6752866&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/02/2017&lt;/TD&gt;&lt;TD&gt;City of London&lt;/TD&gt;&lt;TD&gt;104.7212834&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/03/2017&lt;/TD&gt;&lt;TD&gt;City of London&lt;/TD&gt;&lt;TD&gt;108.9676798&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/04/2017&lt;/TD&gt;&lt;TD&gt;City of London&lt;/TD&gt;&lt;TD&gt;115.6290033&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/05/2017&lt;/TD&gt;&lt;TD&gt;City of London&lt;/TD&gt;&lt;TD&gt;119.9377345&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/06/2017&lt;/TD&gt;&lt;TD&gt;City of London&lt;/TD&gt;&lt;TD&gt;118.7978333&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or like this:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Index_Report_Month&lt;/TD&gt;&lt;TD&gt;Region&lt;/TD&gt;&lt;TD&gt;M2018_06&lt;/TD&gt;&lt;TD&gt;M2018_05&lt;/TD&gt;&lt;TD&gt;M2018_04&lt;/TD&gt;&lt;TD&gt;M2018_03&lt;/TD&gt;&lt;TD&gt;M2018_02&lt;/TD&gt;&lt;TD&gt;M2018_01&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2018-06&lt;/TD&gt;&lt;TD&gt;BEDS&lt;/TD&gt;&lt;TD&gt;136.9514&lt;/TD&gt;&lt;TD&gt;135.1143&lt;/TD&gt;&lt;TD&gt;135.4214&lt;/TD&gt;&lt;TD&gt;135.3575&lt;/TD&gt;&lt;TD&gt;135.7162&lt;/TD&gt;&lt;TD&gt;134.7327&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2018-06&lt;/TD&gt;&lt;TD&gt;BERKS&lt;/TD&gt;&lt;TD&gt;123.3576&lt;/TD&gt;&lt;TD&gt;122.1503&lt;/TD&gt;&lt;TD&gt;121.1386&lt;/TD&gt;&lt;TD&gt;121.7117&lt;/TD&gt;&lt;TD&gt;121.7369&lt;/TD&gt;&lt;TD&gt;121.9318&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2018-06&lt;/TD&gt;&lt;TD&gt;BRISTOL&lt;/TD&gt;&lt;TD&gt;129.4606&lt;/TD&gt;&lt;TD&gt;128.7055&lt;/TD&gt;&lt;TD&gt;129.0354&lt;/TD&gt;&lt;TD&gt;129.9676&lt;/TD&gt;&lt;TD&gt;130.9927&lt;/TD&gt;&lt;TD&gt;130.939&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2018-06&lt;/TD&gt;&lt;TD&gt;BUCKS&lt;/TD&gt;&lt;TD&gt;122.2244&lt;/TD&gt;&lt;TD&gt;121.4971&lt;/TD&gt;&lt;TD&gt;121.595&lt;/TD&gt;&lt;TD&gt;122.5949&lt;/TD&gt;&lt;TD&gt;124.2265&lt;/TD&gt;&lt;TD&gt;124.7186&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2018-06&lt;/TD&gt;&lt;TD&gt;CAMBS&lt;/TD&gt;&lt;TD&gt;124.9302&lt;/TD&gt;&lt;TD&gt;124.736&lt;/TD&gt;&lt;TD&gt;123.9808&lt;/TD&gt;&lt;TD&gt;123.4378&lt;/TD&gt;&lt;TD&gt;123.2373&lt;/TD&gt;&lt;TD&gt;123.1942&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2018-06&lt;/TD&gt;&lt;TD&gt;CHESHIRE&lt;/TD&gt;&lt;TD&gt;112.9974&lt;/TD&gt;&lt;TD&gt;113.5666&lt;/TD&gt;&lt;TD&gt;113.6045&lt;/TD&gt;&lt;TD&gt;112.9975&lt;/TD&gt;&lt;TD&gt;114.1681&lt;/TD&gt;&lt;TD&gt;114.6474&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2018-06&lt;/TD&gt;&lt;TD&gt;CORNWALL&lt;/TD&gt;&lt;TD&gt;114.9373&lt;/TD&gt;&lt;TD&gt;113.9692&lt;/TD&gt;&lt;TD&gt;112.5068&lt;/TD&gt;&lt;TD&gt;113.4169&lt;/TD&gt;&lt;TD&gt;113.5313&lt;/TD&gt;&lt;TD&gt;113.1154&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone please advise how this can be done?&lt;/P&gt;&lt;P&gt;I assume I need to use RETAIN and a macro loop but I am not sure how to do this "moving means", which in excel would be a fairly simple matter.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Much appreciated!&lt;/P&gt;&lt;P&gt;Edo&lt;/P&gt;</description>
    <pubDate>Fri, 14 Sep 2018 15:39:32 GMT</pubDate>
    <dc:creator>eroka</dc:creator>
    <dc:date>2018-09-14T15:39:32Z</dc:date>
    <item>
      <title>Creating a 5 month rolling average - vertically or horizontally (observations or variables)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-5-month-rolling-average-vertically-or-horizontally/m-p/495744#M130907</link>
      <description>&lt;P&gt;I have a data set with 3 variables:&lt;/P&gt;&lt;P&gt;1. Regions - a list of 20&lt;/P&gt;&lt;P&gt;2. Months - the data set has one entry per region per calendar month starting in 2001&lt;/P&gt;&lt;P&gt;3. Index Rate - Each Region each month has one&amp;nbsp;index rate.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Instead of using the index rate per month per region, I need to use instead an average of the index rate from the previous two months and the next two months within the data set.&lt;/P&gt;&lt;P&gt;E.g.&lt;/P&gt;&lt;P&gt;For the Region London for March 2017 I need to assign that month not the index rate that is applicable for March 2017, but an average number for the index rates I have for Jan, Feb, March, April and May 2017.&lt;/P&gt;&lt;P&gt;For April 2017 I would need Feb to June 2017, and so forth.&lt;/P&gt;&lt;P&gt;As I get close to the present and I do not have 2 months in the future I will use the last month's index rate one or twice (i.e. for August 2018 I need to use Jule, August and Sept 3 times).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can do this&amp;nbsp;vertically (i.e. a simple 3 column data set - and then i would need to go up and down the month range) - or if I transpose the data - then with Region on the left column and months as the top headers - it will be horizontally.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The data looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;Region_Name&lt;/TD&gt;&lt;TD&gt;Index&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/01/2016&lt;/TD&gt;&lt;TD&gt;City of London&lt;/TD&gt;&lt;TD&gt;94.01813825&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/02/2016&lt;/TD&gt;&lt;TD&gt;City of London&lt;/TD&gt;&lt;TD&gt;97.70019819&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/03/2016&lt;/TD&gt;&lt;TD&gt;City of London&lt;/TD&gt;&lt;TD&gt;101.4148808&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/04/2016&lt;/TD&gt;&lt;TD&gt;City of London&lt;/TD&gt;&lt;TD&gt;102.7631184&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/05/2016&lt;/TD&gt;&lt;TD&gt;City of London&lt;/TD&gt;&lt;TD&gt;107.900446&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/06/2016&lt;/TD&gt;&lt;TD&gt;City of London&lt;/TD&gt;&lt;TD&gt;115.8611285&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/07/2016&lt;/TD&gt;&lt;TD&gt;City of London&lt;/TD&gt;&lt;TD&gt;116.3539602&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/08/2016&lt;/TD&gt;&lt;TD&gt;City of London&lt;/TD&gt;&lt;TD&gt;108.2436922&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/09/2016&lt;/TD&gt;&lt;TD&gt;City of London&lt;/TD&gt;&lt;TD&gt;99.59944053&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/10/2016&lt;/TD&gt;&lt;TD&gt;City of London&lt;/TD&gt;&lt;TD&gt;101.1481822&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/11/2016&lt;/TD&gt;&lt;TD&gt;City of London&lt;/TD&gt;&lt;TD&gt;104.4657271&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/12/2016&lt;/TD&gt;&lt;TD&gt;City of London&lt;/TD&gt;&lt;TD&gt;103.5881838&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/01/2017&lt;/TD&gt;&lt;TD&gt;City of London&lt;/TD&gt;&lt;TD&gt;104.6752866&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/02/2017&lt;/TD&gt;&lt;TD&gt;City of London&lt;/TD&gt;&lt;TD&gt;104.7212834&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/03/2017&lt;/TD&gt;&lt;TD&gt;City of London&lt;/TD&gt;&lt;TD&gt;108.9676798&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/04/2017&lt;/TD&gt;&lt;TD&gt;City of London&lt;/TD&gt;&lt;TD&gt;115.6290033&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/05/2017&lt;/TD&gt;&lt;TD&gt;City of London&lt;/TD&gt;&lt;TD&gt;119.9377345&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/06/2017&lt;/TD&gt;&lt;TD&gt;City of London&lt;/TD&gt;&lt;TD&gt;118.7978333&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or like this:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Index_Report_Month&lt;/TD&gt;&lt;TD&gt;Region&lt;/TD&gt;&lt;TD&gt;M2018_06&lt;/TD&gt;&lt;TD&gt;M2018_05&lt;/TD&gt;&lt;TD&gt;M2018_04&lt;/TD&gt;&lt;TD&gt;M2018_03&lt;/TD&gt;&lt;TD&gt;M2018_02&lt;/TD&gt;&lt;TD&gt;M2018_01&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2018-06&lt;/TD&gt;&lt;TD&gt;BEDS&lt;/TD&gt;&lt;TD&gt;136.9514&lt;/TD&gt;&lt;TD&gt;135.1143&lt;/TD&gt;&lt;TD&gt;135.4214&lt;/TD&gt;&lt;TD&gt;135.3575&lt;/TD&gt;&lt;TD&gt;135.7162&lt;/TD&gt;&lt;TD&gt;134.7327&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2018-06&lt;/TD&gt;&lt;TD&gt;BERKS&lt;/TD&gt;&lt;TD&gt;123.3576&lt;/TD&gt;&lt;TD&gt;122.1503&lt;/TD&gt;&lt;TD&gt;121.1386&lt;/TD&gt;&lt;TD&gt;121.7117&lt;/TD&gt;&lt;TD&gt;121.7369&lt;/TD&gt;&lt;TD&gt;121.9318&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2018-06&lt;/TD&gt;&lt;TD&gt;BRISTOL&lt;/TD&gt;&lt;TD&gt;129.4606&lt;/TD&gt;&lt;TD&gt;128.7055&lt;/TD&gt;&lt;TD&gt;129.0354&lt;/TD&gt;&lt;TD&gt;129.9676&lt;/TD&gt;&lt;TD&gt;130.9927&lt;/TD&gt;&lt;TD&gt;130.939&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2018-06&lt;/TD&gt;&lt;TD&gt;BUCKS&lt;/TD&gt;&lt;TD&gt;122.2244&lt;/TD&gt;&lt;TD&gt;121.4971&lt;/TD&gt;&lt;TD&gt;121.595&lt;/TD&gt;&lt;TD&gt;122.5949&lt;/TD&gt;&lt;TD&gt;124.2265&lt;/TD&gt;&lt;TD&gt;124.7186&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2018-06&lt;/TD&gt;&lt;TD&gt;CAMBS&lt;/TD&gt;&lt;TD&gt;124.9302&lt;/TD&gt;&lt;TD&gt;124.736&lt;/TD&gt;&lt;TD&gt;123.9808&lt;/TD&gt;&lt;TD&gt;123.4378&lt;/TD&gt;&lt;TD&gt;123.2373&lt;/TD&gt;&lt;TD&gt;123.1942&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2018-06&lt;/TD&gt;&lt;TD&gt;CHESHIRE&lt;/TD&gt;&lt;TD&gt;112.9974&lt;/TD&gt;&lt;TD&gt;113.5666&lt;/TD&gt;&lt;TD&gt;113.6045&lt;/TD&gt;&lt;TD&gt;112.9975&lt;/TD&gt;&lt;TD&gt;114.1681&lt;/TD&gt;&lt;TD&gt;114.6474&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2018-06&lt;/TD&gt;&lt;TD&gt;CORNWALL&lt;/TD&gt;&lt;TD&gt;114.9373&lt;/TD&gt;&lt;TD&gt;113.9692&lt;/TD&gt;&lt;TD&gt;112.5068&lt;/TD&gt;&lt;TD&gt;113.4169&lt;/TD&gt;&lt;TD&gt;113.5313&lt;/TD&gt;&lt;TD&gt;113.1154&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone please advise how this can be done?&lt;/P&gt;&lt;P&gt;I assume I need to use RETAIN and a macro loop but I am not sure how to do this "moving means", which in excel would be a fairly simple matter.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Much appreciated!&lt;/P&gt;&lt;P&gt;Edo&lt;/P&gt;</description>
      <pubDate>Fri, 14 Sep 2018 15:39:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-5-month-rolling-average-vertically-or-horizontally/m-p/495744#M130907</guid>
      <dc:creator>eroka</dc:creator>
      <dc:date>2018-09-14T15:39:32Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a 5 month rolling average - vertically or horizontally (observations or variables)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-5-month-rolling-average-vertically-or-horizontally/m-p/495820#M130948</link>
      <description>&lt;P&gt;So the 1/7/2016 figure for London is the average of&amp;nbsp;107.900446, 115.8611285, 116.3539602, 108.2436922, and 99.59944053?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Sep 2018 20:06:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-5-month-rolling-average-vertically-or-horizontally/m-p/495820#M130948</guid>
      <dc:creator>HB</dc:creator>
      <dc:date>2018-09-14T20:06:39Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a 5 month rolling average - vertically or horizontally (observations or variables)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-5-month-rolling-average-vertically-or-horizontally/m-p/495931#M131016</link>
      <description>&lt;P&gt;Here is an example :&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 *,(select sum(index) from have where date between a.date and a.date+30) as rolling_sum
  from have as a;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 15 Sep 2018 14:30:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-5-month-rolling-average-vertically-or-horizontally/m-p/495931#M131016</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-09-15T14:30:39Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a 5 month rolling average - vertically or horizontally (observations or variables)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-5-month-rolling-average-vertically-or-horizontally/m-p/495988#M131043</link>
      <description>&lt;P&gt;Question 1: It appears that you want a column for each month in which a 5-month-centered average is obtainable.&amp;nbsp; I also understand the reason for one row for each region.&amp;nbsp; What exactly is the meaning of the index_report_month?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Question 2: Do you have sas/ets?&amp;nbsp; If so then proc expand is a simple way to get various rolling window statistics, with leading, trailing, or centered windows of user-specified size.&amp;nbsp; For your situation you would run the data (apparently already sorted by region/date) through proc expand with a by region statement, followed by a proc transpose - although it is not apparent why you want a wide file instead of a narrow one.&lt;/P&gt;</description>
      <pubDate>Sat, 15 Sep 2018 21:11:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-5-month-rolling-average-vertically-or-horizontally/m-p/495988#M131043</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2018-09-15T21:11:49Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a 5 month rolling average - vertically or horizontally (observations or variables)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-5-month-rolling-average-vertically-or-horizontally/m-p/496155#M131146</link>
      <description>That is correct!</description>
      <pubDate>Mon, 17 Sep 2018 09:09:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-5-month-rolling-average-vertically-or-horizontally/m-p/496155#M131146</guid>
      <dc:creator>eroka</dc:creator>
      <dc:date>2018-09-17T09:09:43Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a 5 month rolling average - vertically or horizontally (observations or variables)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-5-month-rolling-average-vertically-or-horizontally/m-p/496160#M131148</link>
      <description>&lt;P&gt;Dear&amp;nbsp;mkeintz,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To answer your questions:&lt;/P&gt;&lt;P&gt;1. The Index Report Month is a string field that I use for each month (format of YYYY-MM) but NOT as a date field. I have found these to be so tricky that it is far better in almost all cases for me to convert the month I am working on to this format. So in this exercise I am relying on&amp;nbsp;Sort as a text - not as a date. Therefore I want to avoid any date calculations as they are really redundant to what I am trying to achieve.&lt;/P&gt;&lt;P&gt;I am under the impression that&amp;nbsp;the solution would be using a "set off" point from the MonthX (=&lt;SPAN&gt;Index_Report_Month)&amp;nbsp;- i.e. climbing up and down two cells from the target month observation itself. I am not familiar how that can be done, as it asking to calculate a mean on 5 target points. I hope you guys can advise on this but if you think the solution will benefit from using a date as a date as a hook - I am not against such thinking.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. I have Enterprise Guide, and I am not familiar with SAS/ets or Proc Expand.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried running an example (&lt;A href="http://support.sas.com/documentation/cdl/en/etsug/63939/HTML/default/viewer.htm#etsug_expand_sect034.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/etsug/63939/HTML/default/viewer.htm#etsug_expand_sect034.htm&lt;/A&gt;) but my SAS returned:&lt;/P&gt;&lt;P&gt;ERROR: Procedure EXPAND not found.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The transposed version is easier for a human to read and is more compact on screen, allowing to compare the rates in different region.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do not mind if the solution will be done vertically (before I transpose the data or after, but there is obviously an advantage to the vertical as then I can create two matrices - one with the rolling average and one with the original data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this is helpful!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Sep 2018 09:26:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-5-month-rolling-average-vertically-or-horizontally/m-p/496160#M131148</guid>
      <dc:creator>eroka</dc:creator>
      <dc:date>2018-09-17T09:26:37Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a 5 month rolling average - vertically or horizontally (observations or variables)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-5-month-rolling-average-vertically-or-horizontally/m-p/496162#M131150</link>
      <description>&lt;P&gt;I forgot to add:&lt;/P&gt;&lt;P&gt;The Index_Report_Month is the month in which the report is ran, so it is irrelevant for process. It's just informs the reader in which month data the data set was correct for. Every month I get a new data set that one more time point added to it - which happened to be two months before the current month (i.e. in August I get the data correct for June, and The Index Report Month would be "2018-06").&lt;/P&gt;</description>
      <pubDate>Mon, 17 Sep 2018 09:35:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-5-month-rolling-average-vertically-or-horizontally/m-p/496162#M131150</guid>
      <dc:creator>eroka</dc:creator>
      <dc:date>2018-09-17T09:35:59Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a 5 month rolling average - vertically or horizontally (observations or variables)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-5-month-rolling-average-vertically-or-horizontally/m-p/496228#M131182</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have managed to work out the means logic using LAG statement.&lt;/P&gt;&lt;P&gt;However I am struggling how to implement it within a loop that is limited to the region (i.e to apply this logic only to the BY group of Region_Name.&lt;/P&gt;&lt;P&gt;This I am sure is a fairly simple loop but I am not sure how to loop between By groups.&lt;/P&gt;&lt;P&gt;Your help would be greatly appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The logic I would want SAS to implement within each Region-Name is as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sort data = Test_Lag;&lt;BR /&gt;by Region_Name Index_Month ;&lt;BR /&gt;&lt;BR /&gt;Data Test_Lag ;&lt;BR /&gt;set Test_Lag ;&lt;BR /&gt;X+1 ;&lt;BR /&gt;Prev_Rate = Lag (Index);&lt;BR /&gt;If Prev_Rate = . then Prev_Rate = Index ;&lt;BR /&gt;Prev2_Rate = Lag2 (Index);&lt;BR /&gt;If Prev2_Rate = . then Prev2_Rate = Prev_Rate ;&lt;BR /&gt;&lt;BR /&gt;proc sort data = Test_Lag;&lt;BR /&gt;by descending x;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data Test_Lag ;&lt;BR /&gt;set Test_Lag ;&lt;BR /&gt;Next_Rate = Lag (Index);&lt;BR /&gt;If Next_Rate = . then Next_Rate = Index ;&lt;BR /&gt;Next2_Rate = Lag2 (Index);&lt;BR /&gt;If Next2_Rate = . then Next2_Rate = Next_Rate ;&lt;BR /&gt;&lt;BR /&gt;proc sort data = Test_Lag;&lt;BR /&gt;by descending Index_Month;&lt;BR /&gt;&lt;BR /&gt;Data Test_Lag ;&lt;BR /&gt;set Test_Lag ;&lt;BR /&gt;Mean_5_Months = mean (Prev2_Rate, Prev_Rate, Index, Next_Rate, Next2_Rate );&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Sep 2018 13:23:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-5-month-rolling-average-vertically-or-horizontally/m-p/496228#M131182</guid>
      <dc:creator>eroka</dc:creator>
      <dc:date>2018-09-17T13:23:32Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a 5 month rolling average - vertically or horizontally (observations or variables)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-5-month-rolling-average-vertically-or-horizontally/m-p/496297#M131209</link>
      <description>&lt;P&gt;This problem is ready-made for a 2-dimensional array in which the row dimension is indexed by year and the column dimension is indexed by month.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This program is edited. See what happens when&amp;nbsp;you don't bother making a data step, and I&amp;nbsp;don't test it against data?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input Date :ddmmyy10. Region_Name :$15. Index ;
  format date yymmddn8.;
datalines;
01/01/2016 City_of_London 94.01813825 
01/02/2016 City_of_London 97.70019819 
01/03/2016 City_of_London 101.4148808 
01/04/2016 City_of_London 102.7631184 
01/05/2016 City_of_London 107.900446 
01/06/2016 City_of_London 115.8611285 
01/07/2016 City_of_London 116.3539602 
01/08/2016 City_of_London 108.2436922 
01/09/2016 City_of_London 99.59944053 
01/10/2016 City_of_London 101.1481822 
01/11/2016 City_of_London 104.4657271 
01/12/2016 City_of_London 103.5881838 
01/01/2017 City_of_London 104.6752866 
01/02/2017 City_of_London 104.7212834 
01/03/2017 City_of_London 108.9676798 
01/04/2017 City_of_London 115.6290033 
01/05/2017 City_of_London 119.9377345 
01/06/2017 City_of_London 118.7978333 
run;
data want (drop=sum_ix index);
  set have;
  by region_name notsorted;
  array ix_mean {2016:2018,1:12}
           m2016_01-m2016_12  
           m2017_01-m2017_12  
           m2018_01-m2018_12     ;
  retain m20: sum_ix;

  if first.region_name then call missing(sum_ix,of ix_mean{*});
  sum_ix + index - coalesce(lag5(index),0);
  
  if lag4(region_name)=region_name then ix_mean{year(date),month(date)}=sum_ix/5;
  if last.region_name;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want (drop=sum_ix);
  set have;
  by region notsorted;&lt;BR /&gt;  array means {2016:2018,1,12}&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m2016_01-m2016_12&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m2017_01-m2017_12&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m2018_01-m2018_12&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;BR /&gt;&amp;nbsp; retain m20: sum_ix;&lt;BR /&gt;
  if first.region then call missing(sum_ix,of ix_mean{*});
  sum_ix + index - coalesce(lag5(index),0);
  
    if lag4(region)=region then mean{year(date),month(date)}=sum_index/5;
  if last.regon;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This program assumes that, for each region the data are sorted by date, but the regional data-groups can be in any order (hence the "by region notsorted").&amp;nbsp; It also assumes you have no holes in the data - otherwise if (say) a record for 2017/04 is missing, then (1) you will have no average for&amp;nbsp; m2017_04, and (2) the results for m2017_05 through m2017_08 will erroneously have a 6-month old component.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Notes:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Be sure to define array bounds to cover all the expected dates.&lt;/LI&gt;
&lt;LI&gt;Since the only time a record is output is when the last record for a region is encountered, the value of DATE will provide the most-recent "vintage" of your data.&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Mon, 17 Sep 2018 19:15:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-5-month-rolling-average-vertically-or-horizontally/m-p/496297#M131209</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2018-09-17T19:15:32Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a 5 month rolling average - vertically or horizontally (observations or variables)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-5-month-rolling-average-vertically-or-horizontally/m-p/496312#M131221</link>
      <description>Hi mkeintz,&lt;BR /&gt;Thank you for your suggestion!&lt;BR /&gt;&lt;BR /&gt;My SAS log returns:&lt;BR /&gt;&lt;BR /&gt;26 data Index_MATRIX_201806_Test_1 (drop=sum_ix);&lt;BR /&gt;27 set Index_MATRIX_201806_Test;&lt;BR /&gt;28 by region notsorted;&lt;BR /&gt;29 if first.region then call missing(sum_ix,of ix_mean{*});&lt;BR /&gt;ERROR: Undeclared array referenced: ix_mean.&lt;BR /&gt;ERROR: The ARRAYNAME[*] specification requires an array.&lt;BR /&gt;30 sum_ix + index - coalesce(lag5(index),0);&lt;BR /&gt;31&lt;BR /&gt;32 array means {2016:2018,1,12}&lt;BR /&gt;33 m2016_01-m2016_12&lt;BR /&gt;34 m2017_01-m2017_12&lt;BR /&gt;35 m2018_01-m2018_12 ;&lt;BR /&gt;36 retain m20: ;&lt;BR /&gt;37&lt;BR /&gt;38 if lag4(region)=region then mean{year(date),month(date)=sum_index/5;&lt;BR /&gt;_&lt;BR /&gt;388&lt;BR /&gt;76&lt;BR /&gt;ERROR: Undeclared array referenced: mean.&lt;BR /&gt;ERROR 388-185: Expecting an arithmetic operator.&lt;BR /&gt;&lt;BR /&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;BR /&gt;&lt;BR /&gt;39 if last.regon;&lt;BR /&gt;40 run;&lt;BR /&gt;&lt;BR /&gt;Any suggestions around the IX_MEAN and MEAN that are undeclared?...&lt;BR /&gt;&lt;BR /&gt;Edo</description>
      <pubDate>Mon, 17 Sep 2018 17:12:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-5-month-rolling-average-vertically-or-horizontally/m-p/496312#M131221</guid>
      <dc:creator>eroka</dc:creator>
      <dc:date>2018-09-17T17:12:35Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a 5 month rolling average - vertically or horizontally (observations or variables)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-5-month-rolling-average-vertically-or-horizontally/m-p/496518#M131348</link>
      <description>&lt;P&gt;Dear MKeintz,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It doesn't work.&amp;nbsp;The error that I get is&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ERROR: Array subscript out of range at line 39 column 41.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I break the code into two and run the first part:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;data Want (drop=sum_ix index);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;set Have ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;by region_name notsorted;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;array ix_mean {2016:2018,1:12}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;m2016_01-m2016_12 &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;m2017_01-m2017_12 &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;m2018_01-m2018_12 ;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;retain m20: sum_ix;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;run;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then I get a huge data set that has all the date range you created in the columns (see attached).&lt;/P&gt;&lt;P&gt;The dataset has 23k records (as many as my observation and then columns as many as you have defined (36 I think).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once I run the second part:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;data WANT_1&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;; set WANT;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;if first.region_name then call missing(sum_ix,of ix_mean{*});&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;sum_ix + index - coalesce(lag5(index),0);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;if lag4(region_name)=region_name then ix_mean{year(date),month(date)}=sum_ix/5;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;if last.region_name;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;run;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then I get more specific errors:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;44 data WANT_1&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;47 ; set WANT;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;49 if first.region_name then call missing(sum_ix,of ix_mean{*});&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#FF0000"&gt;&lt;STRONG&gt;ERROR: Undeclared array referenced: ix_mean.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" color="#FF0000"&gt;&lt;STRONG&gt;ERROR: The ARRAYNAME[*] specification requires an array.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;50 sum_ix + index - coalesce(lag5(index),0);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;51 &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;52 if lag4(region_name)=region_name then ix_mean{year(date),month(date)}=sum_ix/5;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;ERROR: Undeclared array referenced: ix_mean.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;ERROR: Variable ix_mean has not been declared as an array.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;53 if last.region_name;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;54 run;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am not familiar with working with arrays to be honest so this issue with "undeclared array" is an odd one for me - as I can see that you have declared it in:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;array ix_mean {2016:2018,1:12}&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;m2016_01-m2016_12&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;m2017_01-m2017_12&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;m2018_01-m2018_12 ;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;retain m20: sum_ix;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any idea what is going wrong...?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;BTW - my data has no missing observations.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you fro your help!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Edo&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Sep 2018 11:14:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-5-month-rolling-average-vertically-or-horizontally/m-p/496518#M131348</guid>
      <dc:creator>eroka</dc:creator>
      <dc:date>2018-09-18T11:14:48Z</dc:date>
    </item>
  </channel>
</rss>

