<?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: Newbie question: How use the STD function for matrices? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Newbie-question-How-use-the-STD-function-for-matrices/m-p/51256#M14042</link>
    <description>I don't think the STD function works in IML the way you want it to work.&lt;BR /&gt;
&lt;BR /&gt;
I think you have to code up the standard deviation formula in IML. I know there is an example somewhere in the IML documentation where the std dev formula is presented in IML code.</description>
    <pubDate>Thu, 02 Oct 2008 12:08:38 GMT</pubDate>
    <dc:creator>Paige</dc:creator>
    <dc:date>2008-10-02T12:08:38Z</dc:date>
    <item>
      <title>Newbie question: How use the STD function for matrices?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Newbie-question-How-use-the-STD-function-for-matrices/m-p/51255#M14041</link>
      <description>I am very new with SAS. Something I don't grasp is the following:&lt;BR /&gt;
&lt;BR /&gt;
I am using IML. I have a matrix like this:&lt;BR /&gt;
X = {40 1.4 1003,&lt;BR /&gt;
45 0.8, 1123,&lt;BR /&gt;
51 1.2 1175, &lt;BR /&gt;
52 1.1 1014);&lt;BR /&gt;
&lt;BR /&gt;
I want to compute the standard deviation for every column. There is the STD function. But how can it be used in such a case?&lt;BR /&gt;
&lt;BR /&gt;
I tried something like this:&lt;BR /&gt;
STD_X = j(1, ncol(X), -1);&lt;BR /&gt;
do i=1 to ncol(X);&lt;BR /&gt;
STD_X[1,i] = std(X[*,i]);&lt;BR /&gt;
end;&lt;BR /&gt;
&lt;BR /&gt;
However, this does not work. It seems that the type X[*,i] is no valid argument &lt;BR /&gt;
for function STD (neither is t(X[*,i])). If I am not mistaken, X[*,i] returns a (sub-) matrix of values whereas STD expects values or variables containing values.&lt;BR /&gt;
&lt;BR /&gt;
Can't I thus use the STD function?</description>
      <pubDate>Thu, 02 Oct 2008 12:02:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Newbie-question-How-use-the-STD-function-for-matrices/m-p/51255#M14041</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-10-02T12:02:46Z</dc:date>
    </item>
    <item>
      <title>Re: Newbie question: How use the STD function for matrices?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Newbie-question-How-use-the-STD-function-for-matrices/m-p/51256#M14042</link>
      <description>I don't think the STD function works in IML the way you want it to work.&lt;BR /&gt;
&lt;BR /&gt;
I think you have to code up the standard deviation formula in IML. I know there is an example somewhere in the IML documentation where the std dev formula is presented in IML code.</description>
      <pubDate>Thu, 02 Oct 2008 12:08:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Newbie-question-How-use-the-STD-function-for-matrices/m-p/51256#M14042</guid>
      <dc:creator>Paige</dc:creator>
      <dc:date>2008-10-02T12:08:38Z</dc:date>
    </item>
    <item>
      <title>Re: Newbie question: How use the STD function for matrices?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Newbie-question-How-use-the-STD-function-for-matrices/m-p/51257#M14043</link>
      <description>Ok, thanks for your answer. I just found something in the documentation:&lt;BR /&gt;
&lt;BR /&gt;
//-----------------------------------------------------------------&lt;BR /&gt;
Also, SAS/IML software does not support the OF clause of the SAS DATA step. For example, the statement &lt;BR /&gt;
 &lt;BR /&gt;
   a=mean(of x1-x10); /* invalid in IML */&lt;BR /&gt;
&lt;BR /&gt;
cannot be interpreted properly in IML. The term (X1-X10) would be interpreted as subtraction of the two matrix arguments rather than its DATA step meaning, "X1 through X10." &lt;BR /&gt;
//-----------------------------------------------------------------&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
It's the same thing with the mean function as with the std function. As it seems, there is no such idea as computing all elements of a matrix row or matrix column at once with those functions. (It however works with others like sum.)</description>
      <pubDate>Thu, 02 Oct 2008 12:55:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Newbie-question-How-use-the-STD-function-for-matrices/m-p/51257#M14043</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-10-02T12:55:54Z</dc:date>
    </item>
    <item>
      <title>Re: Newbie question: How use the STD function for matrices?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Newbie-question-How-use-the-STD-function-for-matrices/m-p/51258#M14044</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Since SAS/IML 9.22, IML has supported a &lt;A href="http://support.sas.com/documentation/cdl/en/imlug/64248/HTML/default/viewer.htm#imlug_langref_sect323.htm"&gt;VAR function&lt;/A&gt;, which computes the variance of each column of a matrix. Use SQRT(VAR(X)) to get the standard deviation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For how to compute the variance of each column prior to SAS/IML 9.22, see my blog post on "&lt;A href="http://blogs.sas.com/content/iml/2011/04/07/computing-the-variance-of-each-column-of-a-matrix/"&gt;Computing the Variance of Each Column of a Matrix&lt;/A&gt;". &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Oct 2011 12:59:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Newbie-question-How-use-the-STD-function-for-matrices/m-p/51258#M14044</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2011-10-12T12:59:57Z</dc:date>
    </item>
  </channel>
</rss>

