<?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: Fiscal Year Averages in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Fiscal-Year-Averages/m-p/397016#M95924</link>
    <description>Thanks; it worked</description>
    <pubDate>Tue, 19 Sep 2017 05:59:52 GMT</pubDate>
    <dc:creator>Theo_Gh</dc:creator>
    <dc:date>2017-09-19T05:59:52Z</dc:date>
    <item>
      <title>Fiscal Year Averages</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Fiscal-Year-Averages/m-p/397001#M95916</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dataset that looks like this:&lt;/P&gt;&lt;P&gt;Fyear &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Returns&lt;/P&gt;&lt;P&gt;1990 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;&lt;P&gt;1990 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3&lt;/P&gt;&lt;P&gt;1990 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&lt;/P&gt;&lt;P&gt;1991 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;&lt;P&gt;1991 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 5&amp;nbsp;&lt;/P&gt;&lt;P&gt;1991 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4&lt;/P&gt;&lt;P&gt;1992 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4&lt;/P&gt;&lt;P&gt;1992 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3&lt;/P&gt;&lt;P&gt;1992 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/P&gt;&lt;P&gt;I would want to create a new variable called, AVE, that will be equal to the average return for each fiscal year?&lt;/P&gt;&lt;P&gt;&amp;nbsp;May I know the best way to go about this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 19 Sep 2017 03:14:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Fiscal-Year-Averages/m-p/397001#M95916</guid>
      <dc:creator>Theo_Gh</dc:creator>
      <dc:date>2017-09-19T03:14:53Z</dc:date>
    </item>
    <item>
      <title>Re: Fiscal Year Averages</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Fiscal-Year-Averages/m-p/397006#M95918</link>
      <description>&lt;P&gt;Try this....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=HAVE nway missing;
  class fyear;
  var returns;
output out= WANTDS1 mean=;
run;
&lt;BR /&gt;/* OR you can sql */

proc sql;
  create table WANTSql as
select fyear, mean(returns) as ave from HAVE
group by fyear;
quit;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* OR you can sort and a data step */&lt;BR /&gt;proc sort data=HAVE;&lt;BR /&gt;  by FYEAR;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;data WANT_DS2;&lt;BR /&gt;  set HAVE;&lt;BR /&gt;by FYEAR;&lt;BR /&gt;&lt;BR /&gt;if first.FYEAR then do;&lt;BR /&gt;  count=.; ave=.;&lt;BR /&gt;end;&lt;BR /&gt;&lt;BR /&gt;count+1;&lt;BR /&gt;ave+returns;&lt;BR /&gt;&lt;BR /&gt;if last.fyear then do;&lt;BR /&gt;  ave=ave/count;&lt;BR /&gt;  output;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&amp;nbsp;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Sep 2017 04:02:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Fiscal-Year-Averages/m-p/397006#M95918</guid>
      <dc:creator>ShiroAmada</dc:creator>
      <dc:date>2017-09-19T04:02:02Z</dc:date>
    </item>
    <item>
      <title>Re: Fiscal Year Averages</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Fiscal-Year-Averages/m-p/397016#M95924</link>
      <description>Thanks; it worked</description>
      <pubDate>Tue, 19 Sep 2017 05:59:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Fiscal-Year-Averages/m-p/397016#M95924</guid>
      <dc:creator>Theo_Gh</dc:creator>
      <dc:date>2017-09-19T05:59:52Z</dc:date>
    </item>
  </channel>
</rss>

