<?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: Can PROC SQL AVG function be completed using a subset of data depending on another column ? in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Can-PROC-SQL-AVG-function-be-completed-using-a-subset-of-data/m-p/572840#M17590</link>
    <description>&lt;P&gt;Wonderful, thank you&lt;/P&gt;</description>
    <pubDate>Thu, 11 Jul 2019 16:51:57 GMT</pubDate>
    <dc:creator>cfortin</dc:creator>
    <dc:date>2019-07-11T16:51:57Z</dc:date>
    <item>
      <title>Can PROC SQL AVG function be completed using a subset of data depending on another column ?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Can-PROC-SQL-AVG-function-be-completed-using-a-subset-of-data/m-p/572817#M17583</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know there are different ways to do what I want to do but I just can manage to make it work..&lt;/P&gt;&lt;P&gt;I would like to do this in a proc SQL in one select statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have this table named test.&lt;/P&gt;&lt;P&gt;I want to create a new column (D_IL8) that would be IL8 - (mean IL8 for positive outcomes)&lt;/P&gt;&lt;P&gt;Mean IL8 for positive outcomes = (&lt;FONT color="#FF0000"&gt;34+23+34+28+27&lt;/FONT&gt;)/5 = 29.20&lt;/P&gt;&lt;P&gt;So column D-IL8 would be IL8 value for that person - 29.20&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Name&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;IL8&lt;/TD&gt;&lt;TD&gt;Outcome&lt;/TD&gt;&lt;TD&gt;D_IL8&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Marie&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;34,00&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;Positive&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Martha&lt;/TD&gt;&lt;TD&gt;56,00&lt;/TD&gt;&lt;TD&gt;Negative&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Angela&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;23,00&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;Positive&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Jodie&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;34,00&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;Positive&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Alexe&lt;/TD&gt;&lt;TD&gt;44,00&lt;/TD&gt;&lt;TD&gt;Negative&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Jane&lt;/TD&gt;&lt;TD&gt;33,00&lt;/TD&gt;&lt;TD&gt;Negative&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Cassandra&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;28,00&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;Positive&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Olivia&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;27,00&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;Positive&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Anna&lt;/TD&gt;&lt;TD&gt;41,00&lt;/TD&gt;&lt;TD&gt;Negative&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Sarah&lt;/TD&gt;&lt;TD&gt;42,00&lt;/TD&gt;&lt;TD&gt;Negative&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone knows how to do that ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2019 16:14:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Can-PROC-SQL-AVG-function-be-completed-using-a-subset-of-data/m-p/572817#M17583</guid>
      <dc:creator>cfortin</dc:creator>
      <dc:date>2019-07-11T16:14:06Z</dc:date>
    </item>
    <item>
      <title>Re: Can PROC SQL AVG function be completed using a subset of data depending on another column ?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Can-PROC-SQL-AVG-function-be-completed-using-a-subset-of-data/m-p/572820#M17584</link>
      <description>&lt;PRE&gt;proc sql;
create table want as
select *, IL8 - mean(case when Outcome="Positive" then IL8 else . end) as D_IL8
from have;
quit;&lt;/PRE&gt;
&lt;P&gt;Untested, but this should work in theory.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/155750"&gt;@cfortin&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I know there are different ways to do what I want to do but I just can manage to make it work..&lt;/P&gt;
&lt;P&gt;I would like to do this in a proc SQL in one select statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have this table named test.&lt;/P&gt;
&lt;P&gt;I want to create a new column (D_IL8) that would be IL8 - (mean IL8 for positive outcomes)&lt;/P&gt;
&lt;P&gt;Mean IL8 for positive outcomes = (&lt;FONT color="#FF0000"&gt;34+23+34+28+27&lt;/FONT&gt;)/5 = 29.20&lt;/P&gt;
&lt;P&gt;So column D-IL8 would be IL8 value for that person - 29.20&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;P&gt;Name&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;IL8&lt;/TD&gt;
&lt;TD&gt;Outcome&lt;/TD&gt;
&lt;TD&gt;D_IL8&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Marie&lt;/TD&gt;
&lt;TD&gt;&lt;FONT color="#FF0000"&gt;34,00&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&lt;FONT color="#FF0000"&gt;Positive&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Martha&lt;/TD&gt;
&lt;TD&gt;56,00&lt;/TD&gt;
&lt;TD&gt;Negative&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Angela&lt;/TD&gt;
&lt;TD&gt;&lt;FONT color="#FF0000"&gt;23,00&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&lt;FONT color="#FF0000"&gt;Positive&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Jodie&lt;/TD&gt;
&lt;TD&gt;&lt;FONT color="#FF0000"&gt;34,00&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&lt;FONT color="#FF0000"&gt;Positive&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Alexe&lt;/TD&gt;
&lt;TD&gt;44,00&lt;/TD&gt;
&lt;TD&gt;Negative&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Jane&lt;/TD&gt;
&lt;TD&gt;33,00&lt;/TD&gt;
&lt;TD&gt;Negative&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Cassandra&lt;/TD&gt;
&lt;TD&gt;&lt;FONT color="#FF0000"&gt;28,00&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&lt;FONT color="#FF0000"&gt;Positive&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Olivia&lt;/TD&gt;
&lt;TD&gt;&lt;FONT color="#FF0000"&gt;27,00&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&lt;FONT color="#FF0000"&gt;Positive&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Anna&lt;/TD&gt;
&lt;TD&gt;41,00&lt;/TD&gt;
&lt;TD&gt;Negative&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Sarah&lt;/TD&gt;
&lt;TD&gt;42,00&lt;/TD&gt;
&lt;TD&gt;Negative&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does anyone knows how to do that ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you so much&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2019 16:29:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Can-PROC-SQL-AVG-function-be-completed-using-a-subset-of-data/m-p/572820#M17584</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-07-11T16:29:12Z</dc:date>
    </item>
    <item>
      <title>Re: Can PROC SQL AVG function be completed using a subset of data depending on another column ?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Can-PROC-SQL-AVG-function-be-completed-using-a-subset-of-data/m-p/572821#M17585</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/155750"&gt;@cfortin&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you asking for this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;

data have;
input Name :$10. IL8 	Outcome	: $12.;
cards;
Marie	34.00	Positive	 
Martha	56.00	Negative	 
Angela	23.00	Positive	 
Jodie	34.00	Positive	 
Alexe	44.00	Negative	 
Jane	33.00	Negative	 
Cassandra	28.00	Positive	 
Olivia	27.00	Positive	 
Anna	41.00	Negative	 
Sarah	42.00	Negative	 
;


proc sql;
create table want as
select *, mean(ifn(outcome='Positive',il8,.)) as d_il8 format=8.2
from have;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Jul 2019 16:29:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Can-PROC-SQL-AVG-function-be-completed-using-a-subset-of-data/m-p/572821#M17585</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-07-11T16:29:35Z</dc:date>
    </item>
    <item>
      <title>Re: Can PROC SQL AVG function be completed using a subset of data depending on another column ?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Can-PROC-SQL-AVG-function-be-completed-using-a-subset-of-data/m-p/572827#M17586</link>
      <description>&lt;P&gt;An ardent follower of&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi&lt;/a&gt;&amp;nbsp;(i call him boolean champ)&amp;nbsp; would also attempt the following&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want as
select *, sum((outcome='Positive')*il8)/sum(outcome='Positive') as d_il8 format=8.2
from have;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sir&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi&lt;/a&gt;&amp;nbsp; &amp;nbsp;you got me addicted to booleans. I blame you for it! lol&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2019 16:36:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Can-PROC-SQL-AVG-function-be-completed-using-a-subset-of-data/m-p/572827#M17586</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-07-11T16:36:53Z</dc:date>
    </item>
    <item>
      <title>Re: Can PROC SQL AVG function be completed using a subset of data depending on another column ?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Can-PROC-SQL-AVG-function-be-completed-using-a-subset-of-data/m-p/572831#M17587</link>
      <description>&lt;P&gt;Exactly !!&lt;/P&gt;&lt;P&gt;It's exactly what I needed, thank you so much.&lt;/P&gt;&lt;P&gt;I don't totally understand it though.. &amp;nbsp;it's keeping only the IL8 values of outcome=positive and then it does the mean of it ?&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2019 16:39:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Can-PROC-SQL-AVG-function-be-completed-using-a-subset-of-data/m-p/572831#M17587</guid>
      <dc:creator>cfortin</dc:creator>
      <dc:date>2019-07-11T16:39:26Z</dc:date>
    </item>
    <item>
      <title>Re: Can PROC SQL AVG function be completed using a subset of data depending on another column ?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Can-PROC-SQL-AVG-function-be-completed-using-a-subset-of-data/m-p/572832#M17588</link>
      <description>&lt;P&gt;It's working too !! thanks.&lt;/P&gt;&lt;P&gt;just need to add IL8 - before the mean.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2019 16:40:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Can-PROC-SQL-AVG-function-be-completed-using-a-subset-of-data/m-p/572832#M17588</guid>
      <dc:creator>cfortin</dc:creator>
      <dc:date>2019-07-11T16:40:06Z</dc:date>
    </item>
    <item>
      <title>Re: Can PROC SQL AVG function be completed using a subset of data depending on another column ?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Can-PROC-SQL-AVG-function-be-completed-using-a-subset-of-data/m-p/572839#M17589</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/155750"&gt;@cfortin&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;it's keeping only the IL8 values of outcome=positive and then it does the mean of it ?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It essentially creates a new (invisible) column of data that's either missing or the value when positive and takes the mean of that and adds to each row.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2019 16:50:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Can-PROC-SQL-AVG-function-be-completed-using-a-subset-of-data/m-p/572839#M17589</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-07-11T16:50:40Z</dc:date>
    </item>
    <item>
      <title>Re: Can PROC SQL AVG function be completed using a subset of data depending on another column ?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Can-PROC-SQL-AVG-function-be-completed-using-a-subset-of-data/m-p/572840#M17590</link>
      <description>&lt;P&gt;Wonderful, thank you&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2019 16:51:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Can-PROC-SQL-AVG-function-be-completed-using-a-subset-of-data/m-p/572840#M17590</guid>
      <dc:creator>cfortin</dc:creator>
      <dc:date>2019-07-11T16:51:57Z</dc:date>
    </item>
    <item>
      <title>Re: Can PROC SQL AVG function be completed using a subset of data depending on another column ?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Can-PROC-SQL-AVG-function-be-completed-using-a-subset-of-data/m-p/572845#M17591</link>
      <description>&lt;P&gt;An answer that doesn't require PROC SQL. (Assumes data is sorted by OUTCOME)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc stdize data=have method=mean out=want sprefix=D_;
    by outcome;
    var il8;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;My problem with the SQL approaches is that the code works for the case where you only want to do this for the values where OUTCOME='POSITIVE', but you (or someone else who is reading along) will eventually want it for OUTCOME="NEGATIVE" and yes indeed, extra programming in SQL is needed to make this work, but PROC STDIZE requires no additional programming, and it works for any number of values that OUTCOME can have, even if it is more than two.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2019 17:02:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Can-PROC-SQL-AVG-function-be-completed-using-a-subset-of-data/m-p/572845#M17591</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-07-11T17:02:18Z</dc:date>
    </item>
    <item>
      <title>Re: Can PROC SQL AVG function be completed using a subset of data depending on another column ?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Can-PROC-SQL-AVG-function-be-completed-using-a-subset-of-data/m-p/572849#M17592</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp; &amp;nbsp;Very elegant indeed!&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2019 17:04:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Can-PROC-SQL-AVG-function-be-completed-using-a-subset-of-data/m-p/572849#M17592</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-07-11T17:04:04Z</dc:date>
    </item>
    <item>
      <title>Re: Can PROC SQL AVG function be completed using a subset of data depending on another column ?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Can-PROC-SQL-AVG-function-be-completed-using-a-subset-of-data/m-p/572851#M17593</link>
      <description>In that method negative values would not be subtracted from the positive mean though, so it's not quite the same calculation, though more common.</description>
      <pubDate>Thu, 11 Jul 2019 17:06:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Can-PROC-SQL-AVG-function-be-completed-using-a-subset-of-data/m-p/572851#M17593</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-07-11T17:06:59Z</dc:date>
    </item>
    <item>
      <title>Re: Can PROC SQL AVG function be completed using a subset of data depending on another column ?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Can-PROC-SQL-AVG-function-be-completed-using-a-subset-of-data/m-p/572853#M17594</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;In that method negative values would not be subtracted from the positive mean though, so it's not quite the same calculation, though more common.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I don't understand this. As far as I know, negative values are handled properly by PROC STDIZE.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2019 17:12:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Can-PROC-SQL-AVG-function-be-completed-using-a-subset-of-data/m-p/572853#M17594</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-07-11T17:12:20Z</dc:date>
    </item>
    <item>
      <title>Re: Can PROC SQL AVG function be completed using a subset of data depending on another column ?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Can-PROC-SQL-AVG-function-be-completed-using-a-subset-of-data/m-p/572858#M17595</link>
      <description>The calculation the OP wants is ObservedValue - Mean(positiveValues) for all records wether positive or negative. Your code won't do that, the BY statement means that the Negative values would be handled independently.</description>
      <pubDate>Thu, 11 Jul 2019 17:15:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Can-PROC-SQL-AVG-function-be-completed-using-a-subset-of-data/m-p/572858#M17595</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-07-11T17:15:13Z</dc:date>
    </item>
    <item>
      <title>Re: Can PROC SQL AVG function be completed using a subset of data depending on another column ?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Can-PROC-SQL-AVG-function-be-completed-using-a-subset-of-data/m-p/572864#M17597</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;The calculation the OP wants is ObservedValue - Mean(positiveValues) for all records wether positive or negative. Your code won't do that, the BY statement means that the Negative values would be handled independently.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I would not agree with this wording.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would say that the OP wants ObservedValue - Mean (positive OUTCOMEs)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would say that the negative OUTCOMEs would be handled independently by PROC STDIZE, which gives the proper result for the data which has OUTCOME='POSITIVE'.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2019 17:19:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Can-PROC-SQL-AVG-function-be-completed-using-a-subset-of-data/m-p/572864#M17597</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-07-11T17:19:55Z</dc:date>
    </item>
  </channel>
</rss>

