<?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 help!how to get single variable mean for each year in different year? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/help-how-to-get-single-variable-mean-for-each-year-in-different/m-p/18205#M3548</link>
    <description>I want to calculate the average eps for each stkcd in different year.Following is sample.&lt;BR /&gt;
stkcd is stock code,rptdt is reportdate of forecast,feps is forecast eps of stock.&lt;BR /&gt;
Stkcd	Rptdt	               feps&lt;BR /&gt;
002001	2009-07-20	0.22&lt;BR /&gt;
002001	2009-07-08	0.01&lt;BR /&gt;
002001	2009-07-20	0.39&lt;BR /&gt;
002001	2009-12-30	0.182&lt;BR /&gt;
002001	2009-12-31	0.21&lt;BR /&gt;
002001	2009-11-09	0.41&lt;BR /&gt;
002001	2009-12-18	0.41&lt;BR /&gt;
002001	2009-10-26	0.51&lt;BR /&gt;
002001	2009-10-26	0.02&lt;BR /&gt;
002001	2009-10-26	0.182&lt;BR /&gt;
002001	2009-10-26	0.21&lt;BR /&gt;
002001	2004-06-18	0.571&lt;BR /&gt;
002001	2004-06-22	0.11&lt;BR /&gt;
002001	2004-06-22	0.131&lt;BR /&gt;
002001	2004-06-22	0.46&lt;BR /&gt;
002001	2004-06-22	0.528&lt;BR /&gt;
002001	2004-06-23	0.08&lt;BR /&gt;
002001	2004-08-09	0.11&lt;BR /&gt;
002001	2004-08-09	0.37&lt;BR /&gt;
002001	2004-08-09	0.79&lt;BR /&gt;
002003	2009-08-31	0.03&lt;BR /&gt;
002003	2009-08-31	0.02&lt;BR /&gt;
002003	2009-08-31	0.09&lt;BR /&gt;
002003	2009-08-31	0.05&lt;BR /&gt;
002003	2009-08-31	0.07&lt;BR /&gt;
002003	2009-04-30	0&lt;BR /&gt;
002003	2009-04-29	0.07&lt;BR /&gt;
002003	2009-04-30	0.01&lt;BR /&gt;
002003	2009-05-08	0.06&lt;BR /&gt;
002003	2009-07-27	0.05&lt;BR /&gt;
002003	2009-06-05	0.06&lt;BR /&gt;
002004	2005-07-18	0.02&lt;BR /&gt;
002004	2005-07-18	0.015&lt;BR /&gt;
002004	2005-07-18	0&lt;BR /&gt;
002004	2005-07-18	0.1&lt;BR /&gt;
002004	2005-07-18	0.046&lt;BR /&gt;
002004	2005-07-18	0.06&lt;BR /&gt;
002004	2005-07-18	0.436&lt;BR /&gt;
002004	2005-09-19	0.02&lt;BR /&gt;
002004	2005-09-19	0.1&lt;BR /&gt;
how can i program?thanks!urgent! a poor girl..............</description>
    <pubDate>Sun, 09 May 2010 12:56:00 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2010-05-09T12:56:00Z</dc:date>
    <item>
      <title>help!how to get single variable mean for each year in different year?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/help-how-to-get-single-variable-mean-for-each-year-in-different/m-p/18205#M3548</link>
      <description>I want to calculate the average eps for each stkcd in different year.Following is sample.&lt;BR /&gt;
stkcd is stock code,rptdt is reportdate of forecast,feps is forecast eps of stock.&lt;BR /&gt;
Stkcd	Rptdt	               feps&lt;BR /&gt;
002001	2009-07-20	0.22&lt;BR /&gt;
002001	2009-07-08	0.01&lt;BR /&gt;
002001	2009-07-20	0.39&lt;BR /&gt;
002001	2009-12-30	0.182&lt;BR /&gt;
002001	2009-12-31	0.21&lt;BR /&gt;
002001	2009-11-09	0.41&lt;BR /&gt;
002001	2009-12-18	0.41&lt;BR /&gt;
002001	2009-10-26	0.51&lt;BR /&gt;
002001	2009-10-26	0.02&lt;BR /&gt;
002001	2009-10-26	0.182&lt;BR /&gt;
002001	2009-10-26	0.21&lt;BR /&gt;
002001	2004-06-18	0.571&lt;BR /&gt;
002001	2004-06-22	0.11&lt;BR /&gt;
002001	2004-06-22	0.131&lt;BR /&gt;
002001	2004-06-22	0.46&lt;BR /&gt;
002001	2004-06-22	0.528&lt;BR /&gt;
002001	2004-06-23	0.08&lt;BR /&gt;
002001	2004-08-09	0.11&lt;BR /&gt;
002001	2004-08-09	0.37&lt;BR /&gt;
002001	2004-08-09	0.79&lt;BR /&gt;
002003	2009-08-31	0.03&lt;BR /&gt;
002003	2009-08-31	0.02&lt;BR /&gt;
002003	2009-08-31	0.09&lt;BR /&gt;
002003	2009-08-31	0.05&lt;BR /&gt;
002003	2009-08-31	0.07&lt;BR /&gt;
002003	2009-04-30	0&lt;BR /&gt;
002003	2009-04-29	0.07&lt;BR /&gt;
002003	2009-04-30	0.01&lt;BR /&gt;
002003	2009-05-08	0.06&lt;BR /&gt;
002003	2009-07-27	0.05&lt;BR /&gt;
002003	2009-06-05	0.06&lt;BR /&gt;
002004	2005-07-18	0.02&lt;BR /&gt;
002004	2005-07-18	0.015&lt;BR /&gt;
002004	2005-07-18	0&lt;BR /&gt;
002004	2005-07-18	0.1&lt;BR /&gt;
002004	2005-07-18	0.046&lt;BR /&gt;
002004	2005-07-18	0.06&lt;BR /&gt;
002004	2005-07-18	0.436&lt;BR /&gt;
002004	2005-09-19	0.02&lt;BR /&gt;
002004	2005-09-19	0.1&lt;BR /&gt;
how can i program?thanks!urgent! a poor girl..............</description>
      <pubDate>Sun, 09 May 2010 12:56:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/help-how-to-get-single-variable-mean-for-each-year-in-different/m-p/18205#M3548</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-05-09T12:56:00Z</dc:date>
    </item>
    <item>
      <title>Re: help!how to get single variable mean for each year in different year?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/help-how-to-get-single-variable-mean-for-each-year-in-different/m-p/18206#M3549</link>
      <description>Have you looked at using PROC MEANS with a BY statement.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Sun, 09 May 2010 13:00:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/help-how-to-get-single-variable-mean-for-each-year-in-different/m-p/18206#M3549</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-05-09T13:00:16Z</dc:date>
    </item>
    <item>
      <title>Re: help!how to get single variable mean for each year in different year?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/help-how-to-get-single-variable-mean-for-each-year-in-different/m-p/18207#M3550</link>
      <description>In addition to Scott's suggestion for PROC  MEANS, you could also use PROC TABULATE. &lt;BR /&gt;
       &lt;BR /&gt;
One other item to take care of --- since RPTDT is a date field, you will want to use a FORMAT to restrict the RPTDT to YEAR level only (not use RPTDT down to the DAY level). &lt;BR /&gt;
  &lt;BR /&gt;
Last, if all you want is a report then using PROC MEANS or PROC TABULATE will be sufficient. You can use output sent to the LISTING window, if all you need is a plain report or you can use ODS to create HTML, RTF or PDF report output.&lt;BR /&gt;
&lt;BR /&gt;
But, if you need to create a SAS dataset of the averages, then you will need to investigate either the ODS OUTPUT statement or the OUTPUT statement for PROC MEANS or the OUT= option for PROC TABULATE.&lt;BR /&gt;
 &lt;BR /&gt;
The example code below shows how to find the average height for each birth year and the average height for every year and gender combination. Documentation for PROC MEANS is here:&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/a000146728.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/a000146728.htm&lt;/A&gt;&lt;BR /&gt;
         &lt;BR /&gt;
TABULATE here:&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/a000146759.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/a000146759.htm&lt;/A&gt;&lt;BR /&gt;
   &lt;BR /&gt;
cynthia&lt;BR /&gt;
[pre]&lt;BR /&gt;
data bday;&lt;BR /&gt;
  infile datalines;&lt;BR /&gt;
  input name $ bday : yymmdd10. height gender $;&lt;BR /&gt;
return;&lt;BR /&gt;
datalines;&lt;BR /&gt;
alan    1950/11/15  73 M&lt;BR /&gt;
bob     1989/01/29  72 M&lt;BR /&gt;
carl    1983/02/16  76 M&lt;BR /&gt;
dana    1950/11/17  69 F&lt;BR /&gt;
eliza   1989/01/19  64 F&lt;BR /&gt;
fran    1983/02/18  65 F&lt;BR /&gt;
george  1950/11/14  71 M&lt;BR /&gt;
harry   1989/01/19  72 M&lt;BR /&gt;
ian     1983/02/26  74 M&lt;BR /&gt;
jacqie  1950/11/11  68 F&lt;BR /&gt;
kathy   1989/01/19  67 F&lt;BR /&gt;
lulu    1983/02/19  69 F&lt;BR /&gt;
mark    1953/10/25  71 M&lt;BR /&gt;
noah    1989/01/19  73 M&lt;BR /&gt;
oliver  1983/02/26  75 M&lt;BR /&gt;
paula   1950/11/29  65 F&lt;BR /&gt;
quentin 1989/02/23  73 M&lt;BR /&gt;
rosie   1984/03/17  66 F&lt;BR /&gt;
tom     1953/10/12  75 M&lt;BR /&gt;
uma     1989/02/19  68 F&lt;BR /&gt;
victor  1983/02/26  72 M&lt;BR /&gt;
wayne   1950/10/11  73 M&lt;BR /&gt;
xavier  1989/03/13  76 M&lt;BR /&gt;
yanni   1983/04/16  72 M&lt;BR /&gt;
zenia   1984/10/16  54 F&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
                        &lt;BR /&gt;
proc means data=bday mean;&lt;BR /&gt;
  title '1a) MEANS Average Height for each birth year';&lt;BR /&gt;
  var height;&lt;BR /&gt;
  class bday;&lt;BR /&gt;
  format bday year4.;&lt;BR /&gt;
run;&lt;BR /&gt;
                   &lt;BR /&gt;
proc means data=bday mean;&lt;BR /&gt;
  title '1b) MEANS Average Height for each birth year and gender';&lt;BR /&gt;
  var height;&lt;BR /&gt;
  class bday gender;&lt;BR /&gt;
  format bday year4.;&lt;BR /&gt;
run;&lt;BR /&gt;
                     &lt;BR /&gt;
proc tabulate data=bday;&lt;BR /&gt;
  title '2a) TABULATE Average Height for each birth year';&lt;BR /&gt;
  var height;&lt;BR /&gt;
  class bday;&lt;BR /&gt;
  format bday yymmdd2.;&lt;BR /&gt;
  table bday='Year',&lt;BR /&gt;
        height*n height*mean;&lt;BR /&gt;
run;&lt;BR /&gt;
                                 &lt;BR /&gt;
proc tabulate data=bday;&lt;BR /&gt;
  title '2b) TABULATE Average Height for each birth year and gender';&lt;BR /&gt;
  var height;&lt;BR /&gt;
  class bday gender;&lt;BR /&gt;
  format bday yymmdd2.;&lt;BR /&gt;
  table bday='Year' * gender,&lt;BR /&gt;
        height*n height*mean;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Sun, 09 May 2010 14:45:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/help-how-to-get-single-variable-mean-for-each-year-in-different/m-p/18207#M3550</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-05-09T14:45:42Z</dc:date>
    </item>
    <item>
      <title>Re: help!how to get single variable mean for each year in different year?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/help-how-to-get-single-variable-mean-for-each-year-in-different/m-p/18208#M3551</link>
      <description>thanks you two very much!&lt;BR /&gt;
tiyi</description>
      <pubDate>Sun, 09 May 2010 15:15:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/help-how-to-get-single-variable-mean-for-each-year-in-different/m-p/18208#M3551</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-05-09T15:15:24Z</dc:date>
    </item>
  </channel>
</rss>

