<?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: How to calculate the average of some specific rows in one column in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-the-average-of-some-specific-rows-in-one-column/m-p/671960#M201853</link>
    <description>&lt;P&gt;Here is how to, with proc SQL:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select sum(agg_amh) / count(agg_amh) as value format=32.12
from have
where _type_ = 1;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;value
0.000018794681&lt;/PRE&gt;</description>
    <pubDate>Thu, 23 Jul 2020 20:55:41 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2020-07-23T20:55:41Z</dc:date>
    <item>
      <title>How to calculate the average of some specific rows in one column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-the-average-of-some-specific-rows-in-one-column/m-p/671946#M201846</link>
      <description>&lt;P&gt;Hi SAS community,&lt;/P&gt;
&lt;P&gt;I have the input as below:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.PNG" style="width: 295px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/47612i68D88C94897BCCB5/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.PNG" alt="1.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Offtrack a little bit, this one is obtained after using the "sum" statement in proc means.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Back to my question, my column of interest is agg_amh. What I want is to have an average of all rows containing number values but not the first row (because the first row is the aggregate number already). In other words, I am asking how to count the number of rows containing "number" in column "agg_amh" (but the row (1)), then I will use the aggregate number 0.0003195096 divide to this number to get the average number.&lt;/P&gt;
&lt;P&gt;In sum, my ulterior motive is to get the number of rows that contain number but the first row, in this case, we have 17 rows from row 6th to row 22nd. Then I want to divide 0.0003195096 to 17. The final number that I want is 0.0003195096/17=0.0000187946.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many thanks.&lt;/P&gt;
&lt;DIV id="eJOY__extension_root" class="eJOY__extension_root_class" style="all: unset;"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Thu, 23 Jul 2020 19:57:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-the-average-of-some-specific-rows-in-one-column/m-p/671946#M201846</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2020-07-23T19:57:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the average of some specific rows in one column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-the-average-of-some-specific-rows-in-one-column/m-p/671948#M201847</link>
      <description>&lt;P&gt;Please provide us with data as text, not pictures, so that we can test our proposals.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jul 2020 20:17:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-the-average-of-some-specific-rows-in-one-column/m-p/671948#M201847</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2020-07-23T20:17:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the average of some specific rows in one column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-the-average-of-some-specific-rows-in-one-column/m-p/671954#M201849</link>
      <description>Look at your _TYPE_ variable which allows you to group your data. &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 23 Jul 2020 20:32:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-the-average-of-some-specific-rows-in-one-column/m-p/671954#M201849</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-07-23T20:32:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the average of some specific rows in one column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-the-average-of-some-specific-rows-in-one-column/m-p/671955#M201850</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/212695"&gt;@Phil_NZ&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why don't you just apply PROC MEANS again, now to this summary dataset? The exclusion of the first row can be accomplished by a &lt;FONT face="courier new,courier"&gt;firstobs=2&lt;/FONT&gt; dataset option or a WHERE condition (e.g. &lt;FONT face="courier new,courier"&gt;where _type_=1;&lt;/FONT&gt;). The MEAN statistic for variable &lt;FONT face="courier new,courier"&gt;agg_amh&lt;/FONT&gt; is the desired value (and the N statistic is the number of rows in question) since missing values of &lt;FONT face="courier new,courier"&gt;agg_amh&lt;/FONT&gt; are excluded by default.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jul 2020 20:34:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-the-average-of-some-specific-rows-in-one-column/m-p/671955#M201850</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2020-07-23T20:34:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the average of some specific rows in one column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-the-average-of-some-specific-rows-in-one-column/m-p/671957#M201851</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats&lt;/a&gt;&amp;nbsp;, the data is added below, thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV id="eJOY__extension_root" class="eJOY__extension_root_class" style="all: unset;"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Thu, 23 Jul 2020 20:42:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-the-average-of-some-specific-rows-in-one-column/m-p/671957#M201851</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2020-07-23T20:42:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the average of some specific rows in one column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-the-average-of-some-specific-rows-in-one-column/m-p/671960#M201853</link>
      <description>&lt;P&gt;Here is how to, with proc SQL:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select sum(agg_amh) / count(agg_amh) as value format=32.12
from have
where _type_ = 1;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;value
0.000018794681&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Jul 2020 20:55:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-the-average-of-some-specific-rows-in-one-column/m-p/671960#M201853</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2020-07-23T20:55:41Z</dc:date>
    </item>
  </channel>
</rss>

