<?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: proc means for subcategories of data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-means-for-subcategories-of-data/m-p/777712#M247463</link>
    <description>Moving average or rolling average is the term to use in Google for this, but it depends on how your data is structured. &lt;BR /&gt;If you have SAS/ETS this is quite easy, but also very doable within a data step as well. &lt;BR /&gt;&lt;BR /&gt;SAS/ETS example of 12 month moving average&lt;BR /&gt;&lt;A href="https://gist.github.com/statgeek/07a3708dee1225ceb9d4aa75daab2c52" target="_blank"&gt;https://gist.github.com/statgeek/07a3708dee1225ceb9d4aa75daab2c52&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Data step, array approach&lt;BR /&gt;&lt;A href="https://gist.github.com/statgeek/27e23c015eae7953eff2" target="_blank"&gt;https://gist.github.com/statgeek/27e23c015eae7953eff2&lt;/A&gt;</description>
    <pubDate>Mon, 01 Nov 2021 15:58:43 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2021-11-01T15:58:43Z</dc:date>
    <item>
      <title>proc means for subcategories of data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-means-for-subcategories-of-data/m-p/777672#M247447</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have 90 lines of data.&amp;nbsp; I want to calculate the mean and some other metrics for the first 35 years of data, then for years 2-36, then 3-37, etc and then view all of these mean series.&amp;nbsp; How do I do this?&amp;nbsp; Thanks very much for your help.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Nov 2021 13:23:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-means-for-subcategories-of-data/m-p/777672#M247447</guid>
      <dc:creator>6071</dc:creator>
      <dc:date>2021-11-01T13:23:18Z</dc:date>
    </item>
    <item>
      <title>Re: proc means for subcategories of data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-means-for-subcategories-of-data/m-p/777673#M247448</link>
      <description>&lt;P&gt;Can you show us your data?&lt;/P&gt;</description>
      <pubDate>Mon, 01 Nov 2021 13:25:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-means-for-subcategories-of-data/m-p/777673#M247448</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-11-01T13:25:28Z</dc:date>
    </item>
    <item>
      <title>Re: proc means for subcategories of data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-means-for-subcategories-of-data/m-p/777676#M247450</link>
      <description>&lt;P&gt;One method is using a multilabel format&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
    value yearf (multilabel) 
        1-35='1-35'
        2-36='2-36'
        3-37='3-37'
        /* I'm lazy, you type the rest */
;
run;

proc summary data=have nway;
    class year_since_start/mlf format=yearf.;
    var some_other_variables;
    output out=_stats_ mean= std= min= max=/autoname;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Another method, if you have SAS/ETS and PROC EXPAND, is to calculate moving averages of length 35 based upon your year variable. Probably less typing.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Nov 2021 13:48:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-means-for-subcategories-of-data/m-p/777676#M247450</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-11-01T13:48:17Z</dc:date>
    </item>
    <item>
      <title>Re: proc means for subcategories of data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-means-for-subcategories-of-data/m-p/777712#M247463</link>
      <description>Moving average or rolling average is the term to use in Google for this, but it depends on how your data is structured. &lt;BR /&gt;If you have SAS/ETS this is quite easy, but also very doable within a data step as well. &lt;BR /&gt;&lt;BR /&gt;SAS/ETS example of 12 month moving average&lt;BR /&gt;&lt;A href="https://gist.github.com/statgeek/07a3708dee1225ceb9d4aa75daab2c52" target="_blank"&gt;https://gist.github.com/statgeek/07a3708dee1225ceb9d4aa75daab2c52&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Data step, array approach&lt;BR /&gt;&lt;A href="https://gist.github.com/statgeek/27e23c015eae7953eff2" target="_blank"&gt;https://gist.github.com/statgeek/27e23c015eae7953eff2&lt;/A&gt;</description>
      <pubDate>Mon, 01 Nov 2021 15:58:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-means-for-subcategories-of-data/m-p/777712#M247463</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-11-01T15:58:43Z</dc:date>
    </item>
  </channel>
</rss>

