<?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: Obtaining the SD per observation in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Obtaining-the-SD-per-observation/m-p/227789#M41079</link>
    <description>&lt;P&gt;Getting the same PID each time does not mean anything is wrong. &amp;nbsp;It is possible that only one patient has outlier values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When looking for values more than 2 standard deviations from the mean, you may have to consider two standard deviations in both directions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;where (PCh_Contra_entorhinal &amp;gt; &amp;amp;mean + 2*&amp;amp;std) or (PCh_Contra_entorhinal &amp;lt; &amp;amp;mean - 2*&amp;amp;std);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you suspect this is not giving you the right result, print &amp;amp;mean and &amp;amp;std, and inspect 20 lines of data to see if you can confirm whether the result should be different.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2015 23:50:58 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2015-09-29T23:50:58Z</dc:date>
    <item>
      <title>Obtaining the SD per observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Obtaining-the-SD-per-observation/m-p/227601#M41017</link>
      <description>&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Given a dataset sorted by PID (ID of each participant, N=77) with several continuous variables.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to obtain which are the observations (PID) with values &amp;gt; 2 SD from the mean.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am working with data in a temporary dataset called -- cortical_stroke_complete2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The variable of interest is :&amp;nbsp;&lt;STRONG&gt;PCh_CONTRA_entorhinal_tck&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;This is the code that I have been trying without success, I tried different variables and always obtained the same PID. &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;proc sql noprint;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; select mean(PCh_CONTRA_entorhinal_tck) into : mean from cortical_stroke_complete2;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; select std(PCh_CONTRA_entorhinal_tck) into :std from cortical_stroke_complete2;&lt;BR /&gt;&lt;BR /&gt;quit;&lt;BR /&gt;&lt;BR /&gt;data cortical_stroke_complete2;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; set cortical_stroke_complete2;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; where PCh_CONTRA_entorhinal_tck &amp;gt;&amp;amp;mean+2*&amp;amp;std ;&lt;BR /&gt;&lt;BR /&gt;proc print;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Basic SAS programmer. &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Thank you so much!&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2015 02:32:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Obtaining-the-SD-per-observation/m-p/227601#M41017</guid>
      <dc:creator>l_gutierrez1808</dc:creator>
      <dc:date>2015-09-29T02:32:31Z</dc:date>
    </item>
    <item>
      <title>Re: Obtaining the SD per observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Obtaining-the-SD-per-observation/m-p/227602#M41018</link>
      <description>&lt;P&gt;No need for macros to do that. Try this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select *
from cortical_stroke_complete2
having PCh_CONTRA_entorhinal_tck - mean(PCh_CONTRA_entorhinal_tck) &amp;gt; 2*std(PCh_CONTRA_entorhinal_tck);
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(untested)&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2015 03:03:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Obtaining-the-SD-per-observation/m-p/227602#M41018</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2015-09-29T03:03:43Z</dc:date>
    </item>
    <item>
      <title>Re: Obtaining the SD per observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Obtaining-the-SD-per-observation/m-p/227789#M41079</link>
      <description>&lt;P&gt;Getting the same PID each time does not mean anything is wrong. &amp;nbsp;It is possible that only one patient has outlier values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When looking for values more than 2 standard deviations from the mean, you may have to consider two standard deviations in both directions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;where (PCh_Contra_entorhinal &amp;gt; &amp;amp;mean + 2*&amp;amp;std) or (PCh_Contra_entorhinal &amp;lt; &amp;amp;mean - 2*&amp;amp;std);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you suspect this is not giving you the right result, print &amp;amp;mean and &amp;amp;std, and inspect 20 lines of data to see if you can confirm whether the result should be different.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2015 23:50:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Obtaining-the-SD-per-observation/m-p/227789#M41079</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-09-29T23:50:58Z</dc:date>
    </item>
  </channel>
</rss>

