<?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: average sales in an year in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/average-sales-in-an-year/m-p/32650#M6311</link>
    <description>&amp;gt; total=sum(of mon1-mon12);&lt;BR /&gt;
avesales = mean(of mon1-mon12);&lt;BR /&gt;
&lt;BR /&gt;
There are a number of statistics functions.  These roughly correspond to the statistics available in the MEANS/SUMMARY procedure.  Functions work against the PDV (across variables) for an observation.  The MEANS/SUMMARY works across observations.</description>
    <pubDate>Thu, 11 Nov 2010 21:08:02 GMT</pubDate>
    <dc:creator>ArtC</dc:creator>
    <dc:date>2010-11-11T21:08:02Z</dc:date>
    <item>
      <title>average sales in an year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/average-sales-in-an-year/m-p/32648#M6309</link>
      <description>outlet   product segment mon1 to mon12 ,where mon1 to mon12 are sales dollars for 12 months,are the fields in the dataset.there are 7000 records.&lt;BR /&gt;
I'm wondering if we can find the average of sales for year without using proc transpose to bring in all mon1 to mon12 under single column?</description>
      <pubDate>Thu, 11 Nov 2010 20:50:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/average-sales-in-an-year/m-p/32648#M6309</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2010-11-11T20:50:20Z</dc:date>
    </item>
    <item>
      <title>Re: average sales in an year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/average-sales-in-an-year/m-p/32649#M6310</link>
      <description>total=sum(of mon1-mon12);</description>
      <pubDate>Thu, 11 Nov 2010 21:01:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/average-sales-in-an-year/m-p/32649#M6310</guid>
      <dc:creator>Bill</dc:creator>
      <dc:date>2010-11-11T21:01:26Z</dc:date>
    </item>
    <item>
      <title>Re: average sales in an year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/average-sales-in-an-year/m-p/32650#M6311</link>
      <description>&amp;gt; total=sum(of mon1-mon12);&lt;BR /&gt;
avesales = mean(of mon1-mon12);&lt;BR /&gt;
&lt;BR /&gt;
There are a number of statistics functions.  These roughly correspond to the statistics available in the MEANS/SUMMARY procedure.  Functions work against the PDV (across variables) for an observation.  The MEANS/SUMMARY works across observations.</description>
      <pubDate>Thu, 11 Nov 2010 21:08:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/average-sales-in-an-year/m-p/32650#M6311</guid>
      <dc:creator>ArtC</dc:creator>
      <dc:date>2010-11-11T21:08:02Z</dc:date>
    </item>
    <item>
      <title>Re: average sales in an year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/average-sales-in-an-year/m-p/32651#M6312</link>
      <description>This gives avg sales per record.but I want avg sales for whole data.</description>
      <pubDate>Thu, 11 Nov 2010 21:12:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/average-sales-in-an-year/m-p/32651#M6312</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2010-11-11T21:12:20Z</dc:date>
    </item>
    <item>
      <title>Re: average sales in an year</title>
      <link>https://communities.sas.com/t5/SAS-Programming/average-sales-in-an-year/m-p/32652#M6313</link>
      <description>Hi:&lt;BR /&gt;
  Your original post said that you wanted&lt;BR /&gt;
&lt;B&gt;average of sales for year &lt;/B&gt;. I made the same assumption that other folks did and I thought your data probably looked something like this:&lt;BR /&gt;
[pre]&lt;BR /&gt;
  Year       mon1       mon2       mon3       mon4       mon5       mon6       mon7       mon8       mon9      mon10      mon11      mon12&lt;BR /&gt;
  2000     264074     269994     265954     266141     280331     266302     272390     273274     285721     286556     278729     279212&lt;BR /&gt;
  2001     278466     278948     286522     278980     278516     275090     285408     283625     274469     287157     288108     281379&lt;BR /&gt;
  2002     330275     337671     332619     332849     350591     333036     340659     341773     357322     358370     348601     349192&lt;BR /&gt;
  2003     348255     348874     358334     348904     348321     344049     356928     354707     343262     359132     360316     351914&lt;BR /&gt;
  2004     348255     348874     358334     348904     348321     344049     356928     354707     343262     359132     360316     351914&lt;BR /&gt;
  2005     264074     269994     265954     266141     280331     266302     272390     273274     285721     286556     278729     279212&lt;BR /&gt;
  2006     278466     278948     286522     278980     278516     275090     285408     283625     274469     287157     288108     281379&lt;BR /&gt;
  2007     330275     337671     332619     332849     350591     333036     340659     341773     357322     358370     348601     349192&lt;BR /&gt;
[/pre]&lt;BR /&gt;
                   &lt;BR /&gt;
You said you had 7000 obs, I just figured you had a yearly data for some group scenario. Now, I don't understand what you mean by "avg sales for whole data" -- average sales for ALL the MONTHS across ALL the obs?????&lt;BR /&gt;
&lt;BR /&gt;
I don't see that you'd need to transpose the data to get an overall mean or a grand total. If you did have  a sum across all the months for every obs, then either PROC MEANS, PROC TABULATE or PROC REPORT could get you either a report or an output dataset. Only the reports are shown in the code below. Note that PROC TABULATE can produce multiple tables with different combos of month, year variables.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia&lt;BR /&gt;
[pre]&lt;BR /&gt;
data yrdata;&lt;BR /&gt;
   infile datalines;&lt;BR /&gt;
   input year mon1-mon12;&lt;BR /&gt;
return;&lt;BR /&gt;
datalines;&lt;BR /&gt;
  2000     264074     269994     265954     266141     280331     266302     272390     273274     285721     286556     278729     279212&lt;BR /&gt;
  2001     278466     278948     286522     278980     278516     275090     285408     283625     274469     287157     288108     281379&lt;BR /&gt;
  2002     330275     337671     332619     332849     350591     333036     340659     341773     357322     358370     348601     349192&lt;BR /&gt;
  2003     348255     348874     358334     348904     348321     344049     356928     354707     343262     359132     360316     351914&lt;BR /&gt;
  2004     348255     348874     358334     348904     348321     344049     356928     354707     343262     359132     360316     351914&lt;BR /&gt;
  2005     264074     269994     265954     266141     280331     266302     272390     273274     285721     286556     278729     279212&lt;BR /&gt;
  2006     278466     278948     286522     278980     278516     275090     285408     283625     274469     287157     288108     281379&lt;BR /&gt;
  2007     330275     337671     332619     332849     350591     333036     340659     341773     357322     358370     348601     349192&lt;BR /&gt;
&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
               &lt;BR /&gt;
title;            &lt;BR /&gt;
data yrtot;&lt;BR /&gt;
  set yrdata;&lt;BR /&gt;
  obstot = sum(of mon1-mon12);&lt;BR /&gt;
run;&lt;BR /&gt;
           &lt;BR /&gt;
** Using PROC MEANS for OVERALL SUM and MEAN; &lt;BR /&gt;
proc means data=yrtot sum mean;&lt;BR /&gt;
  var obstot;&lt;BR /&gt;
run;&lt;BR /&gt;
                   &lt;BR /&gt;
** Using PROC REPORT for a REPORT with the overall SUM and MEAN and individual months too;&lt;BR /&gt;
proc report data=yrtot nowd;&lt;BR /&gt;
column year mon1-mon12 obstot obstot=mntot;&lt;BR /&gt;
define year / group;&lt;BR /&gt;
define obstot / sum 'Sum of All Months' f=comma12.;&lt;BR /&gt;
define mntot / mean 'Mean of All Months' f=comma12.;&lt;BR /&gt;
rbreak after/summarize;&lt;BR /&gt;
format mon1-mon12 comma12.;&lt;BR /&gt;
run;&lt;BR /&gt;
       &lt;BR /&gt;
** Using PROC TABULATE for a REPORT with the overall SUM and MEAN;&lt;BR /&gt;
proc tabulate data=yrtot f=comma12.;&lt;BR /&gt;
  var mon1-mon12 obstot;&lt;BR /&gt;
  class year;&lt;BR /&gt;
  table year all,&lt;BR /&gt;
        sum*(mon1-mon12)  obstot*(sum mean) / box='With Year';&lt;BR /&gt;
          &lt;BR /&gt;
  table year all,&lt;BR /&gt;
        obstot*(sum mean) / box='With Year but Without Months';&lt;BR /&gt;
           &lt;BR /&gt;
  table all,&lt;BR /&gt;
        sum*(mon1-mon12) obstot*(sum mean) / box='Without Year';&lt;BR /&gt;
             &lt;BR /&gt;
  table all,&lt;BR /&gt;
        obstot*(sum mean) / box='Without Months';&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Thu, 11 Nov 2010 22:19:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/average-sales-in-an-year/m-p/32652#M6313</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-11-11T22:19:01Z</dc:date>
    </item>
  </channel>
</rss>

