<?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: getting a standard deviation from proc sql in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/getting-a-standard-deviation-from-proc-sql/m-p/436028#M23015</link>
    <description>&lt;P&gt;SAS has functions to calculate both mean and standard deviation in sql. e.g.:&lt;/P&gt;
&lt;PRE&gt;             avg(age) as Mean format 10.2, 
             std(age) as std  format 10.2 label 'Std Dev'&lt;/PRE&gt;
&lt;P&gt;The following paper shows most of the others:&amp;nbsp;&lt;SPAN&gt;www2.sas.com/proceedings/forum2007/072-2007.pdf&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 11 Feb 2018 00:35:45 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2018-02-11T00:35:45Z</dc:date>
    <item>
      <title>getting a standard deviation from proc sql</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/getting-a-standard-deviation-from-proc-sql/m-p/436024#M23014</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I created a new variable called "Indem" that is a mean (sum/N) in proc SQL&amp;nbsp;and it works. However, I'd like to get a standard deviation from this mean. I think there is a function within proc sql that is STD but I don't see sample code for it on the SAS website. Does anyone know where it goes and how to format?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks!!!&lt;/P&gt;&lt;P&gt;Laura&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table cpc as select Paid, 
Sum(Indemnity)/count(CASE_ID) as Indem,
from datahave group by Paid;
quit;&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Feb 2018 23:57:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/getting-a-standard-deviation-from-proc-sql/m-p/436024#M23014</guid>
      <dc:creator>lmyers2</dc:creator>
      <dc:date>2018-02-10T23:57:53Z</dc:date>
    </item>
    <item>
      <title>Re: getting a standard deviation from proc sql</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/getting-a-standard-deviation-from-proc-sql/m-p/436028#M23015</link>
      <description>&lt;P&gt;SAS has functions to calculate both mean and standard deviation in sql. e.g.:&lt;/P&gt;
&lt;PRE&gt;             avg(age) as Mean format 10.2, 
             std(age) as std  format 10.2 label 'Std Dev'&lt;/PRE&gt;
&lt;P&gt;The following paper shows most of the others:&amp;nbsp;&lt;SPAN&gt;www2.sas.com/proceedings/forum2007/072-2007.pdf&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Feb 2018 00:35:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/getting-a-standard-deviation-from-proc-sql/m-p/436028#M23015</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-02-11T00:35:45Z</dc:date>
    </item>
    <item>
      <title>Re: getting a standard deviation from proc sql</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/getting-a-standard-deviation-from-proc-sql/m-p/436032#M23016</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/165633"&gt;@lmyers2&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I created a new variable called "Indem" that is a mean (sum/N) in proc SQL&amp;nbsp;and it works. However, I'd like to get a standard deviation from this mean.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Do you mean to say "standard deviation &lt;EM&gt;of&lt;/EM&gt; the mean"??&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If that's what you mean, you can program this as a simple formula, std(indemnity)/sqrt(n), or you can use PROC MEANS/PROC SUMMARY to compute the MEAN and the standard deviation of the mean (STDERR) without you having to write the formula yourself.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In fact, PROC MEANS/PROC SUMMARY is a superior method for another reason. Doing the math as you have&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Sum(Indemnity)/count(CASE_ID) as Indem,&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;will produce the WRONG mean if there are missing values in Indemnity but not in CASE_ID, or vice versa. Your standard deviation calculation will also be wrong in this case.&lt;/P&gt;</description>
      <pubDate>Sun, 11 Feb 2018 12:52:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/getting-a-standard-deviation-from-proc-sql/m-p/436032#M23016</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-02-11T12:52:34Z</dc:date>
    </item>
    <item>
      <title>Re: getting a standard deviation from proc sql</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/getting-a-standard-deviation-from-proc-sql/m-p/436055#M23017</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/165633"&gt;@lmyers2&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I think there is a function within proc sql that is STD but I don't see sample code for it on the SAS website. Does anyone know where it goes and how to format?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;List of functions is here, with some examples below the list:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/kb/25/279.html" target="_blank"&gt;http://support.sas.com/kb/25/279.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Feb 2018 03:27:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/getting-a-standard-deviation-from-proc-sql/m-p/436055#M23017</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-02-11T03:27:47Z</dc:date>
    </item>
  </channel>
</rss>

