<?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: CDF of Normal in PROC IML in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/CDF-of-Normal-in-PROC-IML/m-p/314928#M3109</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*NORMINV of Random Binomial Probability of Default*/
%let N = 10;
%let M= 3;
proc iml;
call randseed(123);
x = j(&amp;amp;N,&amp;amp;M);
cdf=j(&amp;amp;N,&amp;amp;M);
q=j(&amp;amp;N,&amp;amp;M);
p = {.100 .200 .500};
p_mat = repeat(p, &amp;amp;N);
stdev_mat=p_mat#(1-p_mat);
N_mat = repeat(&amp;amp;N, &amp;amp;N, &amp;amp;M);
call randgen(x, "Binomial", p_mat, N_mat);
x=x/&amp;amp;N;/*Random probability of default*/
q = quantile("Normal", x, p_mat, stdev_mat); /*Quantile of the probability
 from normal distribution (Distance to default)*/
mean=mean(x);
max=x[&amp;lt;&amp;gt;,];
min=x[&amp;gt;&amp;lt;,];
print p,mean,max,min,x,q;
Quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Hi&amp;nbsp;&lt;SPAN class="login-bold"&gt;&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684" target="_self"&gt;Rick_SAS&lt;/A&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have refined the code with your help and now I am passing on a matrix of probabilities to the function using the formula you suggested. However, I am getting an error on Quantile function again i.e.&amp;nbsp;&lt;STRONG&gt;ERROR: (execution) Invalid argument to function.&lt;/STRONG&gt;&amp;nbsp; Just to give you some background: I am trying to generate random variables using the mean probability of default ( matrix x) and then want to calculate distance to default by finding the &lt;/SPAN&gt;&lt;SPAN&gt;quantile ( matrix q) assuming normal distribution. Thanks for your help in advance.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 28 Nov 2016 19:35:41 GMT</pubDate>
    <dc:creator>abbaskashif</dc:creator>
    <dc:date>2016-11-28T19:35:41Z</dc:date>
    <item>
      <title>CDF of Normal in PROC IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/CDF-of-Normal-in-PROC-IML/m-p/312826#M3081</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is an example of a code that works fine and matrix of x is correct. The problem occurs with y as I am getting a matrix of 1s only. Is it because Quantile function is not supported by IML?&amp;nbsp;I am new to SAS IML. Please help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/* Inverse CDF of Binomial PD*/&lt;BR /&gt;%let N = 100;&lt;BR /&gt;%let M= 3;&lt;BR /&gt;proc iml;&lt;BR /&gt;call randseed(123);&lt;BR /&gt;x = j(&amp;amp;N,&amp;amp;M);&lt;BR /&gt;y = j(&amp;amp;N,&amp;amp;M);&lt;BR /&gt;mu= j(1,&amp;amp;M);&lt;BR /&gt;stdev= j(1,&amp;amp;M);&lt;BR /&gt;mu= {.2 .1 .5};&lt;BR /&gt;stdev= mu#(1-mu);&lt;BR /&gt;call randgen(x, "Normal",mu, stdev);&lt;BR /&gt;y= Quantile("NORMAL",x);&lt;BR /&gt;print mu;&lt;BR /&gt;print x;&lt;BR /&gt;print y;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Sat, 19 Nov 2016 21:30:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/CDF-of-Normal-in-PROC-IML/m-p/312826#M3081</guid>
      <dc:creator>abbaskashif</dc:creator>
      <dc:date>2016-11-19T21:30:50Z</dc:date>
    </item>
    <item>
      <title>Re: CDF of Normal in PROC IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/CDF-of-Normal-in-PROC-IML/m-p/312859#M3082</link>
      <description>&lt;PRE&gt;
What are you looking for?
Your code is not right.
If you want get Quantile, you need offer probability not the value (x) from Normal Distribution.

&lt;/PRE&gt;</description>
      <pubDate>Sun, 20 Nov 2016 03:01:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/CDF-of-Normal-in-PROC-IML/m-p/312859#M3082</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-11-20T03:01:02Z</dc:date>
    </item>
    <item>
      <title>Re: CDF of Normal in PROC IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/CDF-of-Normal-in-PROC-IML/m-p/312860#M3083</link>
      <description>&lt;P&gt;I think you want get CDF not Quantile. You take x(value from normal distribution) as Quantile ?&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;/* Inverse CDF of Binomial PD*/
%let N = 100;
%let M= 3;

proc iml;
call randseed(123);
x = j(&amp;amp;N,&amp;amp;M);
y = j(&amp;amp;N,&amp;amp;M);
cdf=j(&amp;amp;N,&amp;amp;M);
mu= {.2 .1 .5};
stdev= mu#(1-mu);
call randgen(x, "Normal",mu, stdev);

do i=1 to &amp;amp;M;
  cdf[,i]=cdf('normal',x[,i],mu[i],stdev[i]);
end;
print mu,stdev,x,cdf;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 20 Nov 2016 03:06:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/CDF-of-Normal-in-PROC-IML/m-p/312860#M3083</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-11-20T03:06:05Z</dc:date>
    </item>
    <item>
      <title>Re: CDF of Normal in PROC IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/CDF-of-Normal-in-PROC-IML/m-p/312872#M3084</link>
      <description>&lt;P&gt;The QUANTILE function requires an argument that is between 0 and 1. &amp;nbsp; Please review &lt;A href="http://blogs.sas.com/content/iml/2011/10/19/four-essential-functions-for-statistical-programmers.html" target="_self"&gt;the definitions of the four different probability functions PDF, CDF, QUANTILE, and RAND/RANDGEN.&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can compute the CDF (P(X &amp;lt; x)) &amp;nbsp;for each of th e random values. You can then call the QUANTILE (inverse CDF) function to recover the x values, as &amp;nbsp;shown in KSharp's code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One thing to keep in mind: the RANDGEN function is vectorized SAS/IML function.&amp;nbsp;You are &amp;nbsp;calling it with a&amp;nbsp;vector of parameters so that each&amp;nbsp;column has &amp;nbsp;different parameters. That is legal, since the doc says the parameters can be scalar, row &amp;nbsp;vector (apply to cols), column vector (apply to rows), or matrix. &amp;nbsp;However, the CDF and QUANTILE functions are &amp;nbsp;Base SAS functions, so they only support scalar or matrix parameters. &amp;nbsp;That is why KSharp &amp;nbsp;used a loop over the columns. The &amp;nbsp; other option is to create a matrix of parameters, like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;mu_mat = repeat(mu, &amp;amp;N);&lt;BR /&gt;stdev_mat = repeat(stdev, &amp;amp;N);&lt;BR /&gt;y = cdf("NORMAL",x, mu_mat, stdev_mat);&lt;BR /&gt;q = quantile("Normal", y, mu_mat, stdev_mat); /* same as x */&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 20 Nov 2016 11:39:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/CDF-of-Normal-in-PROC-IML/m-p/312872#M3084</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-11-20T11:39:23Z</dc:date>
    </item>
    <item>
      <title>Re: CDF of Normal in PROC IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/CDF-of-Normal-in-PROC-IML/m-p/312893#M3085</link>
      <description>&lt;P&gt;I see you already got your answer, but off topic: remember to put a QUIT&amp;nbsp;statement at the end of your code &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In IML the RUN statement is a bit different from most other procedures and the data step. In IML the RUN statement executes&amp;nbsp;&lt;SPAN&gt;built-in subroutines or&amp;nbsp;user-defined modules.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 20 Nov 2016 14:55:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/CDF-of-Normal-in-PROC-IML/m-p/312893#M3085</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2016-11-20T14:55:36Z</dc:date>
    </item>
    <item>
      <title>Re: CDF of Normal in PROC IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/CDF-of-Normal-in-PROC-IML/m-p/312924#M3086</link>
      <description>&lt;P&gt;To add to draycut's message, see the article &lt;A href="http://blogs.sas.com/content/iml/2010/09/13/never-end-proc-iml-with-a-run-statement.html" target="_self"&gt;"Never end PROC IML with a RUN statement."&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 20 Nov 2016 20:00:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/CDF-of-Normal-in-PROC-IML/m-p/312924#M3086</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-11-20T20:00:25Z</dc:date>
    </item>
    <item>
      <title>Re: CDF of Normal in PROC IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/CDF-of-Normal-in-PROC-IML/m-p/312928#M3087</link>
      <description>&lt;P&gt;Thank you all for your quick responses. I didn't know we had such a cooperative SAS &amp;nbsp;community.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Creating matrices of parameters (mu_mat and stdev_mat) is quite intuitive and seems to be working fine. However, it seems that I am having some problem with RANDGEN too. Although I am specifying the parameters as vectors they seem to be taken as scalars. Specifically, RANDGEN seems to be taking only the first parameter (.01) in the vector below and applies it to whole matrix.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;mu= j(1, &amp;amp;M);&lt;BR /&gt;mu= {.01 .1 .6};&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It would also help if you could&amp;nbsp;elaborate a bit more on what do you mean by 'row&amp;nbsp;&lt;SPAN&gt;vector (apply to cols), column vector (apply to rows)'. I was goin gthrough the doc and it&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;says: "if the parameters contain &lt;/SPAN&gt;&lt;SPAN class=" AAmathtext"&gt;m&lt;/SPAN&gt;&lt;SPAN&gt; elements, the &lt;/SPAN&gt;&lt;SPAN class=" AAmathtext"&gt;j&lt;/SPAN&gt;&lt;SPAN&gt;th column of the &lt;/SPAN&gt;&lt;SPAN class=" AAargument"&gt;result&lt;/SPAN&gt;&lt;SPAN&gt; matrix consists of random values drawn from the distribution with parameters &lt;/SPAN&gt;&lt;SPAN class=" AAargument"&gt;param1[j]&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN class=" AAargument"&gt;param2[j]&lt;/SPAN&gt;&lt;SPAN&gt;, and &lt;/SPAN&gt;&lt;SPAN class=" AAargument"&gt;param3[j]".&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=" AAargument"&gt;Thanks in advance.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 20 Nov 2016 21:16:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/CDF-of-Normal-in-PROC-IML/m-p/312928#M3087</guid>
      <dc:creator>abbaskashif</dc:creator>
      <dc:date>2016-11-20T21:16:46Z</dc:date>
    </item>
    <item>
      <title>Re: CDF of Normal in PROC IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/CDF-of-Normal-in-PROC-IML/m-p/312951#M3088</link>
      <description>&lt;P&gt;Vectors of paremeters for the RANDGEN subroutine were introduced in SAS/IML 12.1&amp;nbsp;(SAS 9.3m2).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorry for the confusion about row vectors and column vectors. You are right (the doc is right) about the way that dimensions are used. In my own work, I &amp;nbsp;make the parameter vector be a row vector (1 row, m columns) when I want the parameters to apply to the columns. &amp;nbsp;I make the parameter vector be a column vector (n rows, 1 column) &amp;nbsp;when I want the parameters to apply to the rows. As y ou point out, this convention is not strictly required, but I think it is a good idea. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here are examples. In the first example I compute the mean of each column of x and show that the column&amp;nbsp;means are&amp;nbsp;close to the population mean. &amp;nbsp;In the second example, I compute the sample mean for each row of y and show that the row&amp;nbsp;means are close to the population means.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
call randseed(1);

x = j(100, 3);  /* 3 cols */
mu  = 1:3;   /* row vector: ncol(mu)=ncol(x) */
call randgen(x, "normal", mu);
mean = mean(x); /* mean of each col */
print mu, mean;

y = j(5, 200);  /* 5 rows */
mu2  = T(1:5);   /* col vector: nrow(mu)=nrow(y ) */
call randgen(y, "normal", mu2);
mean2 = y[,:];  /* mean of each row */
print mu2 mean2;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2016 00:19:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/CDF-of-Normal-in-PROC-IML/m-p/312951#M3088</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-11-21T00:19:02Z</dc:date>
    </item>
    <item>
      <title>Re: CDF of Normal in PROC IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/CDF-of-Normal-in-PROC-IML/m-p/313279#M3090</link>
      <description>&lt;P&gt;Thanks for your detailed explanation on parameters as vectors/matrices.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Although the RANDGEN function should work on a vector of parameters, it doesn't give me the intended results. Even after generating a full matrix of parameter p&amp;nbsp;&lt;SPAN&gt;in the code below&amp;nbsp;&lt;/SPAN&gt;by repeating the row&amp;nbsp;vector (effectively a &lt;SPAN&gt;N*M matrix)&lt;/SPAN&gt;, the results clearly suggest that p is being taken as a scalar i.e. only the first element of p=0.1 from the matrix is used.&amp;nbsp;Do you have any&amp;nbsp;suggestions?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;%let N = 100;&lt;BR /&gt;%let M= 3;&lt;BR /&gt;proc iml;&lt;BR /&gt;call randseed(123);&lt;BR /&gt;x = j(&amp;amp;N,&amp;amp;M);&lt;BR /&gt;y = j(&amp;amp;N,&amp;amp;M);&lt;BR /&gt;p= j(1, &amp;amp;M);/*specify row vector*/&lt;BR /&gt;p= {.1 .2 .5}; /*Probability*/&lt;BR /&gt;p_mat = repeat(p, &amp;amp;N); /*Repeat probability parameter for j(&amp;amp;N,&amp;amp;M) matrix*/&lt;BR /&gt;call randgen(x, "Binomial",p_mat,&amp;amp;N );&lt;BR /&gt;x=x/&amp;amp;N;&lt;BR /&gt;mean=mean(x);&lt;BR /&gt;max=max(x);&lt;BR /&gt;print p,mean,max;&lt;BR /&gt;Quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;RESULT:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;p&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;0.1&lt;/TD&gt;&lt;TD&gt;0.2&lt;/TD&gt;&lt;TD&gt;0.5&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;mean&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;0.1014&lt;/TD&gt;&lt;TD&gt;0.1001&lt;/TD&gt;&lt;TD&gt;0.1075&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;max&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;0.2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Mon, 21 Nov 2016 21:38:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/CDF-of-Normal-in-PROC-IML/m-p/313279#M3090</guid>
      <dc:creator>abbaskashif</dc:creator>
      <dc:date>2016-11-21T21:38:49Z</dc:date>
    </item>
    <item>
      <title>Re: CDF of Normal in PROC IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/CDF-of-Normal-in-PROC-IML/m-p/313285#M3091</link>
      <description>Thanks. I realized the mistake &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Mon, 21 Nov 2016 21:41:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/CDF-of-Normal-in-PROC-IML/m-p/313285#M3091</guid>
      <dc:creator>abbaskashif</dc:creator>
      <dc:date>2016-11-21T21:41:42Z</dc:date>
    </item>
    <item>
      <title>Re: CDF of Normal in PROC IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/CDF-of-Normal-in-PROC-IML/m-p/313287#M3092</link>
      <description>Thanks for your advice. I realize that IML is different but quite convenient too if one is good at it.</description>
      <pubDate>Mon, 21 Nov 2016 21:45:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/CDF-of-Normal-in-PROC-IML/m-p/313287#M3092</guid>
      <dc:creator>abbaskashif</dc:creator>
      <dc:date>2016-11-21T21:45:33Z</dc:date>
    </item>
    <item>
      <title>Re: CDF of Normal in PROC IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/CDF-of-Normal-in-PROC-IML/m-p/314928#M3109</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*NORMINV of Random Binomial Probability of Default*/
%let N = 10;
%let M= 3;
proc iml;
call randseed(123);
x = j(&amp;amp;N,&amp;amp;M);
cdf=j(&amp;amp;N,&amp;amp;M);
q=j(&amp;amp;N,&amp;amp;M);
p = {.100 .200 .500};
p_mat = repeat(p, &amp;amp;N);
stdev_mat=p_mat#(1-p_mat);
N_mat = repeat(&amp;amp;N, &amp;amp;N, &amp;amp;M);
call randgen(x, "Binomial", p_mat, N_mat);
x=x/&amp;amp;N;/*Random probability of default*/
q = quantile("Normal", x, p_mat, stdev_mat); /*Quantile of the probability
 from normal distribution (Distance to default)*/
mean=mean(x);
max=x[&amp;lt;&amp;gt;,];
min=x[&amp;gt;&amp;lt;,];
print p,mean,max,min,x,q;
Quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Hi&amp;nbsp;&lt;SPAN class="login-bold"&gt;&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684" target="_self"&gt;Rick_SAS&lt;/A&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have refined the code with your help and now I am passing on a matrix of probabilities to the function using the formula you suggested. However, I am getting an error on Quantile function again i.e.&amp;nbsp;&lt;STRONG&gt;ERROR: (execution) Invalid argument to function.&lt;/STRONG&gt;&amp;nbsp; Just to give you some background: I am trying to generate random variables using the mean probability of default ( matrix x) and then want to calculate distance to default by finding the &lt;/SPAN&gt;&lt;SPAN&gt;quantile ( matrix q) assuming normal distribution. Thanks for your help in advance.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2016 19:35:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/CDF-of-Normal-in-PROC-IML/m-p/314928#M3109</guid>
      <dc:creator>abbaskashif</dc:creator>
      <dc:date>2016-11-28T19:35:41Z</dc:date>
    </item>
    <item>
      <title>Re: CDF of Normal in PROC IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/CDF-of-Normal-in-PROC-IML/m-p/315071#M3112</link>
      <description>&lt;PRE&gt;
Because there are zero in X .
You can't use 0 as a argument in function QUANTILE() .



x
0.1	0	0.3
0.1	0.1	0.4
0	0.1	0.3
0	0.4	0.4
0.1	0.5	0.6
0.2	0.1	0.6
0	0.2	0.7
0	0	0.3
0.1	0.3	0.7
0.2	0.2	0.7

&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Nov 2016 03:34:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/CDF-of-Normal-in-PROC-IML/m-p/315071#M3112</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-11-29T03:34:05Z</dc:date>
    </item>
    <item>
      <title>Re: CDF of Normal in PROC IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/CDF-of-Normal-in-PROC-IML/m-p/315271#M3113</link>
      <description>&lt;P&gt;You are right thanks. I'll have tofigure out a way to get around this.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Nov 2016 17:20:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/CDF-of-Normal-in-PROC-IML/m-p/315271#M3113</guid>
      <dc:creator>abbaskashif</dc:creator>
      <dc:date>2016-11-29T17:20:10Z</dc:date>
    </item>
  </channel>
</rss>

