<?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 Summing Months by year in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Summing-Months-by-year/m-p/442004#M23258</link>
    <description>&lt;P&gt;I have a dataset with Year in the rows, and&amp;nbsp; the months Sep-May as the columns. I am trying to sum the months by year, in this case Sep-May is considered one year. I am unsure of how to go about this as I cannot figure out how to sum all 9 months together for about 200 years.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is what I've been working with though I have been unsuccessful.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc means data=schoolyear sum maxdec=0;&lt;BR /&gt;class year;&lt;BR /&gt;var Sep Oct Nov Dec Jan Feb Mar Apr May;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance!&lt;/P&gt;</description>
    <pubDate>Sat, 03 Mar 2018 03:00:36 GMT</pubDate>
    <dc:creator>emkotnik</dc:creator>
    <dc:date>2018-03-03T03:00:36Z</dc:date>
    <item>
      <title>Summing Months by year</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Summing-Months-by-year/m-p/442004#M23258</link>
      <description>&lt;P&gt;I have a dataset with Year in the rows, and&amp;nbsp; the months Sep-May as the columns. I am trying to sum the months by year, in this case Sep-May is considered one year. I am unsure of how to go about this as I cannot figure out how to sum all 9 months together for about 200 years.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is what I've been working with though I have been unsuccessful.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc means data=schoolyear sum maxdec=0;&lt;BR /&gt;class year;&lt;BR /&gt;var Sep Oct Nov Dec Jan Feb Mar Apr May;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance!&lt;/P&gt;</description>
      <pubDate>Sat, 03 Mar 2018 03:00:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Summing-Months-by-year/m-p/442004#M23258</guid>
      <dc:creator>emkotnik</dc:creator>
      <dc:date>2018-03-03T03:00:36Z</dc:date>
    </item>
    <item>
      <title>Re: Summing Months by year</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Summing-Months-by-year/m-p/442011#M23259</link>
      <description>&lt;P&gt;If you're summing within a single row, then you would use the SUM function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set schoolyear;

annual_total = sum(sep, oct, nov, ... , may); *if the variables are NOT side by side you have to list them all;

annual_total2 = sum(of sep--may); *if the variables are side by side;

run;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/162192"&gt;@emkotnik&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I have a dataset with Year in the rows, and&amp;nbsp; the months Sep-May as the columns. I am trying to sum the months by year, in this case Sep-May is considered one year. I am unsure of how to go about this as I cannot figure out how to sum all 9 months together for about 200 years.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is what I've been working with though I have been unsuccessful.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc means data=schoolyear sum maxdec=0;&lt;BR /&gt;class year;&lt;BR /&gt;var Sep Oct Nov Dec Jan Feb Mar Apr May;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you in advance!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 03 Mar 2018 03:29:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Summing-Months-by-year/m-p/442011#M23259</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-03-03T03:29:00Z</dc:date>
    </item>
    <item>
      <title>Re: Summing Months by year</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Summing-Months-by-year/m-p/442015#M23260</link>
      <description>&lt;P&gt;I would sum up in a slightly different order.&amp;nbsp; First, begin with the program you have, but put the results into an output data set:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;proc means data=schoolyear noprint nway;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;class year;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var Sep Oct Nov Dec Jan Feb Mar Apr May;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;output out=monthly_totals (drop=_type_ _freq_) sum=;&lt;BR /&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This gives you a SAS data set with the same 10 variables you started with, but the month variables all contain the SUM of their original values.&amp;nbsp; In other words, you have a much smaller data set:&amp;nbsp; 200 observations (one for each year) and the same 10 variables.&amp;nbsp; If you want to add them up, it's easy:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;data want;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;set monthly_totals;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;yearly_total = Sep + Oct + Nov + Dec + Jan + Feb + Mar + Apr + May;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The advantage of doing the steps in this order occurs when you start with a lot of observations.&amp;nbsp; You don't need to add up the 9 monthly values for every observation ... just add their totals that come out of PROC MEANS.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 03 Mar 2018 03:41:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Summing-Months-by-year/m-p/442015#M23260</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-03-03T03:41:51Z</dc:date>
    </item>
  </channel>
</rss>

