<?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: Computing the average by variable. in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Computing-the-average-by-variable/m-p/45640#M1997</link>
    <description>One way would be:&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
create table &lt;NEW dataset=""&gt; as&lt;BR /&gt;
   select class, height, mean(height) as avg_height_in _class&lt;BR /&gt;
   from &lt;OLD dataset=""&gt;&lt;BR /&gt;
   group by class, height ;&lt;BR /&gt;
quit;&lt;/OLD&gt;&lt;/NEW&gt;</description>
    <pubDate>Mon, 25 Jan 2010 17:10:28 GMT</pubDate>
    <dc:creator>sfleming</dc:creator>
    <dc:date>2010-01-25T17:10:28Z</dc:date>
    <item>
      <title>Computing the average by variable.</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Computing-the-average-by-variable/m-p/45637#M1994</link>
      <description>How can I create a new variable as an average by.&lt;BR /&gt;
&lt;BR /&gt;
Example: I need code to get the avg_hight in class:&lt;BR /&gt;
&lt;BR /&gt;
class   hight       avg_hight_in _class&lt;BR /&gt;
a          6                  7&lt;BR /&gt;
a          7                  7&lt;BR /&gt;
a          8                  7&lt;BR /&gt;
b          4                  5&lt;BR /&gt;
b          5                  5&lt;BR /&gt;
b          6                  5</description>
      <pubDate>Fri, 22 Jan 2010 16:50:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Computing-the-average-by-variable/m-p/45637#M1994</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-01-22T16:50:22Z</dc:date>
    </item>
    <item>
      <title>Re: Computing the average by variable.</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Computing-the-average-by-variable/m-p/45638#M1995</link>
      <description>I mean in the above example, I got a table of three columns:&lt;BR /&gt;
Class, Hight and Average hight.&lt;BR /&gt;
There are two classes, thre observations each. &lt;BR /&gt;
What code can give me the third column (The average in class)?&lt;BR /&gt;
Malek</description>
      <pubDate>Mon, 25 Jan 2010 15:37:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Computing-the-average-by-variable/m-p/45638#M1995</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-01-25T15:37:42Z</dc:date>
    </item>
    <item>
      <title>Re: Computing the average by variable.</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Computing-the-average-by-variable/m-p/45639#M1996</link>
      <description>PROC MEANS with at BY variable;&lt;BR /&gt;
&lt;BR /&gt;
or PROC SUMMARY with a CLASS variable</description>
      <pubDate>Mon, 25 Jan 2010 17:09:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Computing-the-average-by-variable/m-p/45639#M1996</guid>
      <dc:creator>Paige</dc:creator>
      <dc:date>2010-01-25T17:09:38Z</dc:date>
    </item>
    <item>
      <title>Re: Computing the average by variable.</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Computing-the-average-by-variable/m-p/45640#M1997</link>
      <description>One way would be:&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
create table &lt;NEW dataset=""&gt; as&lt;BR /&gt;
   select class, height, mean(height) as avg_height_in _class&lt;BR /&gt;
   from &lt;OLD dataset=""&gt;&lt;BR /&gt;
   group by class, height ;&lt;BR /&gt;
quit;&lt;/OLD&gt;&lt;/NEW&gt;</description>
      <pubDate>Mon, 25 Jan 2010 17:10:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Computing-the-average-by-variable/m-p/45640#M1997</guid>
      <dc:creator>sfleming</dc:creator>
      <dc:date>2010-01-25T17:10:28Z</dc:date>
    </item>
    <item>
      <title>Re: Computing the average by variable.</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Computing-the-average-by-variable/m-p/45641#M1998</link>
      <description>Thank you sfleming, I used the code you've just given to me as follows:&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
create table &lt;SPACE.AVGTABLE&gt; as&lt;BR /&gt;
select ind_qtr_qnt, lag4_roa, mean(lag4_roa) as avg_lag4_roa&lt;BR /&gt;
from &lt;SPACE.SDATAEM6&gt;&lt;BR /&gt;
group by ind_qtr_qnt, lag4_roa ;&lt;BR /&gt;
quit; &lt;BR /&gt;
&lt;BR /&gt;
But it didn't work and I got the following log message:&lt;BR /&gt;
&lt;BR /&gt;
.&lt;BR /&gt;
14   proc sql;&lt;BR /&gt;
15   create table &lt;SPACE.AVGTABLE&gt; as&lt;BR /&gt;
                  -&lt;BR /&gt;
                  22&lt;BR /&gt;
NOTE: The SAS System was unable to open the macro library referenced by the SASMSTORE = libref&lt;BR /&gt;
      SASUSER.&lt;BR /&gt;
15   create table &lt;SPACE.AVGTABLE&gt; as&lt;BR /&gt;
                   --------------&lt;BR /&gt;
                   201&lt;BR /&gt;
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string.&lt;BR /&gt;
&lt;BR /&gt;
ERROR 201-322: The option is not recognized and will be ignored.&lt;BR /&gt;
&lt;BR /&gt;
16   select ind_qtr_qnt, lag4_roa, mean(lag4_roa) as avg_lag4_roa&lt;BR /&gt;
17   from &lt;SPACE.SDATAEM6&gt;&lt;BR /&gt;
          -&lt;BR /&gt;
          22&lt;BR /&gt;
           --------------&lt;BR /&gt;
           201&lt;BR /&gt;
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, (,&lt;BR /&gt;
              CONNECTION, DICTIONARY.&lt;BR /&gt;
&lt;BR /&gt;
ERROR 201-322: The option is not recognized and will be ignored.&lt;BR /&gt;
&lt;BR /&gt;
18   group by ind_qtr_qnt, lag4_roa ;&lt;BR /&gt;
19   quit;&lt;BR /&gt;
NOTE: The SAS System was unable to open the macro library referenced by the SASMSTORE = libref&lt;BR /&gt;
      SASUSER.&lt;BR /&gt;
NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;
NOTE: PROCEDURE SQL used (Total process time):&lt;BR /&gt;
      real time           0.00 seconds&lt;BR /&gt;
      cpu time            0.00 seconds&lt;/SPACE.SDATAEM6&gt;&lt;/SPACE.AVGTABLE&gt;&lt;/SPACE.AVGTABLE&gt;&lt;/SPACE.SDATAEM6&gt;&lt;/SPACE.AVGTABLE&gt;</description>
      <pubDate>Tue, 26 Jan 2010 12:11:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Computing-the-average-by-variable/m-p/45641#M1998</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-01-26T12:11:35Z</dc:date>
    </item>
    <item>
      <title>Re: Computing the average by variable.</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Computing-the-average-by-variable/m-p/45642#M1999</link>
      <description>Omit the brackets - they are to designate "your input/output file" in the example.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
DOC reference from SAS support website:&lt;BR /&gt;
&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/sqlproc/62086/HTML/default/a002536894.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/sqlproc/62086/HTML/default/a002536894.htm&lt;/A&gt;</description>
      <pubDate>Tue, 26 Jan 2010 12:40:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Computing-the-average-by-variable/m-p/45642#M1999</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-01-26T12:40:16Z</dc:date>
    </item>
  </channel>
</rss>

