<?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 can i produce syntax in IML9.2 equivalent to &amp;quot; NORM.INV &amp;quot; in excel? in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-can-i-produce-syntax-in-IML9-2-equivalent-to-quot-NORM-INV/m-p/161318#M1525</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well done. Thanks Rick .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 27 Dec 2014 08:18:17 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2014-12-27T08:18:17Z</dc:date>
    <item>
      <title>How can i produce syntax in IML9.2 equivalent to " NORM.INV " in excel?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-can-i-produce-syntax-in-IML9-2-equivalent-to-quot-NORM-INV/m-p/161311#M1518</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am striving to calculate Value at risk in financial market, in order to produce 10% VaR in excel it is easy to use Norm.inv(probability,mean,std). what is the same code in IML?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Furthermore in excel we have " small(array,3) " to calculate 3rd smallest value. how is it done in IML?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help me in this topic. thanks in advance..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Dec 2014 17:59:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-can-i-produce-syntax-in-IML9-2-equivalent-to-quot-NORM-INV/m-p/161311#M1518</guid>
      <dc:creator>hamed_jabarian</dc:creator>
      <dc:date>2014-12-23T17:59:47Z</dc:date>
    </item>
    <item>
      <title>Re: How can i produce syntax in IML9.2 equivalent to " NORM.INV " in excel?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-can-i-produce-syntax-in-IML9-2-equivalent-to-quot-NORM-INV/m-p/161312#M1519</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The inverse CDF function is called the &lt;A href="http://support.sas.com/documentation/cdl/en/lefunctionsref/67398/HTML/default/viewer.htm#n0uhywbqfucg6qn18woziy41flqp.htm"&gt;QUANTILE function &lt;/A&gt;in SAS. To compute the inverse CDF of the normal distribution, use the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc iml;&lt;/P&gt;&lt;P&gt;prob=0.5; mean=0; std=1;&lt;/P&gt;&lt;P&gt;q = quantile("Normal", prob, mean, std);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For computing the kth smallest, I'd use the &lt;A href="http://support.sas.com/documentation/cdl/en/imlug/66845/HTML/default/viewer.htm#imlug_langref_sect364.htm"&gt;RANK function.&lt;/A&gt;, which returns the order of each element in a sorted list.&amp;nbsp; You can use the LOC function to find the index that contains the kth smallest, and then extract the value, as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;x = 100:91;&lt;/P&gt;&lt;P&gt;r = rank(x);&lt;/P&gt;&lt;P&gt;idx = loc(r=3);&amp;nbsp;&amp;nbsp; /* location of the 3rd smallest */&lt;/P&gt;&lt;P&gt;small3 = x[idx];&amp;nbsp; /* value of the 3rd smallest */&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Dec 2014 12:54:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-can-i-produce-syntax-in-IML9-2-equivalent-to-quot-NORM-INV/m-p/161312#M1519</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2014-12-24T12:54:20Z</dc:date>
    </item>
    <item>
      <title>Re: How can i produce syntax in IML9.2 equivalent to " NORM.INV " in excel?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-can-i-produce-syntax-in-IML9-2-equivalent-to-quot-NORM-INV/m-p/161313#M1520</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rick,&lt;/P&gt;&lt;P&gt;What if there are some ties ? How to get rid of them ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;
proc iml;
m = { 1 2 0,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2 4 0,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10 11 12,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2 2 2};
r=rank(m);
x=loc(r=3); 
smallest3=m&lt;X&gt;;
print smallest3;
quit;

&lt;/X&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Dec 2014 13:11:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-can-i-produce-syntax-in-IML9-2-equivalent-to-quot-NORM-INV/m-p/161313#M1520</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-12-24T13:11:58Z</dc:date>
    </item>
    <item>
      <title>Re: How can i produce syntax in IML9.2 equivalent to " NORM.INV " in excel?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-can-i-produce-syntax-in-IML9-2-equivalent-to-quot-NORM-INV/m-p/161314#M1521</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Real Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Dec 2014 14:01:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-can-i-produce-syntax-in-IML9-2-equivalent-to-quot-NORM-INV/m-p/161314#M1521</guid>
      <dc:creator>hamed_jabarian</dc:creator>
      <dc:date>2014-12-24T14:01:26Z</dc:date>
    </item>
    <item>
      <title>Re: How can i produce syntax in IML9.2 equivalent to " NORM.INV " in excel?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-can-i-produce-syntax-in-IML9-2-equivalent-to-quot-NORM-INV/m-p/161315#M1522</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why would I want to get rid of them? The algorithm returns the observations with the k_th smallest values.&amp;nbsp; If you just want one, you can use&lt;/P&gt;&lt;P&gt;smallest3=m&lt;X&gt;[1];&lt;/X&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Dec 2014 12:38:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-can-i-produce-syntax-in-IML9-2-equivalent-to-quot-NORM-INV/m-p/161315#M1522</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2014-12-26T12:38:11Z</dc:date>
    </item>
    <item>
      <title>Re: How can i produce syntax in IML9.2 equivalent to " NORM.INV " in excel?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-can-i-produce-syntax-in-IML9-2-equivalent-to-quot-NORM-INV/m-p/161316#M1523</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As you can see the code return 1,but the smallest 3 is 2 . so do I get that 2 ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Dec 2014 13:48:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-can-i-produce-syntax-in-IML9-2-equivalent-to-quot-NORM-INV/m-p/161316#M1523</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-12-26T13:48:32Z</dc:date>
    </item>
    <item>
      <title>Re: How can i produce syntax in IML9.2 equivalent to " NORM.INV " in excel?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-can-i-produce-syntax-in-IML9-2-equivalent-to-quot-NORM-INV/m-p/161317#M1524</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, I didn't understand your question previously.&amp;nbsp; In your example you have two 0s. Your code returns 1 because that is the third value in a ranked list of the values: 0, 0, 1, 2, 2, 2,.... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to return all values that have the third largest UNIQUE value (which is 2), then you can use the UNIQUE-LOC technique: &lt;A href="http://blogs.sas.com/content/iml/2011/11/01/the-unique-loc-trick-a-real-treat/" title="http://blogs.sas.com/content/iml/2011/11/01/the-unique-loc-trick-a-real-treat/"&gt; The UNIQUE-LOC trick: A real treat! - The DO Loop&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The code would look like this:&lt;/P&gt;&lt;P&gt;m = { 1 2 0,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2 4 0,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10 11 12,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2 2 2};&lt;/P&gt;&lt;P&gt;u = unique(m);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* unique values */&lt;/P&gt;&lt;P&gt;k = 3;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* look for the k_th smallest */&lt;/P&gt;&lt;P&gt;idx = loc(m=u&lt;K&gt;); /* find observations */&lt;/K&gt;&lt;/P&gt;&lt;P&gt;print (idx`)[L="Obs Num"] (m[idx])[L="Value"];&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Dec 2014 18:10:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-can-i-produce-syntax-in-IML9-2-equivalent-to-quot-NORM-INV/m-p/161317#M1524</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2014-12-26T18:10:29Z</dc:date>
    </item>
    <item>
      <title>Re: How can i produce syntax in IML9.2 equivalent to " NORM.INV " in excel?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-can-i-produce-syntax-in-IML9-2-equivalent-to-quot-NORM-INV/m-p/161318#M1525</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well done. Thanks Rick .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 27 Dec 2014 08:18:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-can-i-produce-syntax-in-IML9-2-equivalent-to-quot-NORM-INV/m-p/161318#M1525</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-12-27T08:18:17Z</dc:date>
    </item>
  </channel>
</rss>

