<?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>Hutch_sas Tracker</title>
    <link>https://communities.sas.com/kntur85557/tracker</link>
    <description>Hutch_sas Tracker</description>
    <pubDate>Mon, 25 May 2026 09:26:34 GMT</pubDate>
    <dc:date>2026-05-25T09:26:34Z</dc:date>
    <item>
      <title>Re: Is it possible to redefine subroutines in a subroutine?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Is-it-possible-to-redefine-subroutines-in-a-subroutine/m-p/189712#M1941</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The optimization method should only be generating feasible points in the search. It looks like you are setting conh before you define mincvf(); your statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;conh={0.4 . .,. . .,. . .};&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;should come AFTER the"start mincvf(CVF1);" statement.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Jul 2014 15:43:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Is-it-possible-to-redefine-subroutines-in-a-subroutine/m-p/189712#M1941</guid>
      <dc:creator>Hutch_sas</dc:creator>
      <dc:date>2014-07-25T15:43:54Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to redefine subroutines in a subroutine?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Is-it-possible-to-redefine-subroutines-in-a-subroutine/m-p/189710#M1939</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could specify a lower bound or linear constraint, see in the IML doc under Nonlinear Optimization Examples-&amp;gt;Details-&amp;gt;Parameter Constraints&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jul 2014 20:22:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Is-it-possible-to-redefine-subroutines-in-a-subroutine/m-p/189710#M1939</guid>
      <dc:creator>Hutch_sas</dc:creator>
      <dc:date>2014-07-24T20:22:38Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to redefine subroutines in a subroutine?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Is-it-possible-to-redefine-subroutines-in-a-subroutine/m-p/189708#M1937</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;the warning appears to be saying that the value of (sum(le)-le&lt;X&gt;) is 0. This could be due to loss&lt;/X&gt;&lt;/P&gt;&lt;P&gt;of precision if le&lt;X&gt; &amp;gt;&amp;gt; le&lt;I&gt;, i != x. I recommend you add some conditional print statements, like&lt;/I&gt;&lt;/X&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if (sum(le) - le&lt;X&gt;) = 0 then do;&lt;/X&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; print temp1, x, i, ue, le;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt; in front of the statement: t5&lt;X&gt;=(sum(ue)-ue&lt;X&gt;)/(sum(le)-le&lt;X&gt;); &lt;/X&gt;&lt;/X&gt;&lt;/X&gt;&lt;/P&gt;&lt;P&gt;to see what is going on.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2014 19:55:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Is-it-possible-to-redefine-subroutines-in-a-subroutine/m-p/189708#M1937</guid>
      <dc:creator>Hutch_sas</dc:creator>
      <dc:date>2014-07-23T19:55:16Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to redefine subroutines in a subroutine?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Is-it-possible-to-redefine-subroutines-in-a-subroutine/m-p/189706#M1935</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;start outer(p,m) global(newp);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2014 14:50:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Is-it-possible-to-redefine-subroutines-in-a-subroutine/m-p/189706#M1935</guid>
      <dc:creator>Hutch_sas</dc:creator>
      <dc:date>2014-07-23T14:50:55Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to redefine subroutines in a subroutine?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Is-it-possible-to-redefine-subroutines-in-a-subroutine/m-p/189704#M1933</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your subroutine "outer" needs to declare newp in a global clause. Otherwise, when it sets newp it is working with a local variable only, and the "global" newp is not initialized. That is causing the first error in your log.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2014 13:28:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Is-it-possible-to-redefine-subroutines-in-a-subroutine/m-p/189704#M1933</guid>
      <dc:creator>Hutch_sas</dc:creator>
      <dc:date>2014-07-23T13:28:19Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to redefine subroutines in a subroutine?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Is-it-possible-to-redefine-subroutines-in-a-subroutine/m-p/189700#M1929</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oops, I see that you will also have to manipulate m within the loop, but you get the idea?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jul 2014 14:36:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Is-it-possible-to-redefine-subroutines-in-a-subroutine/m-p/189700#M1929</guid>
      <dc:creator>Hutch_sas</dc:creator>
      <dc:date>2014-07-22T14:36:34Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to redefine subroutines in a subroutine?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Is-it-possible-to-redefine-subroutines-in-a-subroutine/m-p/189699#M1928</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In IML all subroutine definitions are global, even if you define then inside another subroutine. In your example, could you not accomplish the same goal by using a global clause in mhatx2 and Kmod? That is, use&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;start mhatx2(h) global(p,m,pi,e);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;start Kmod(x,h) global(pi,e);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and manipulate p in your "outer" routine. maybe use something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;start outer(p_input) global(p,e,pi,m); m=nrow(p_input); &lt;/P&gt;&lt;P&gt; [your existing code]&lt;/P&gt;&lt;P&gt;p = p_input(w);&lt;/P&gt;&lt;P&gt;hyi&lt;X&gt;=mincvf(CVF1);&lt;/X&gt;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jul 2014 14:30:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Is-it-possible-to-redefine-subroutines-in-a-subroutine/m-p/189699#M1928</guid>
      <dc:creator>Hutch_sas</dc:creator>
      <dc:date>2014-07-22T14:30:30Z</dc:date>
    </item>
    <item>
      <title>Re: Product of functions/Variable scope</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Product-of-functions-Variable-scope/m-p/179922#M1793</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You need to modify the line:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call quad(val&lt;I&gt;, "Func", yinterval); /* evaluate integral on [0, 1] */&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;val&lt;I&gt; will not be replaced by the quad call. do&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call quad(result, "Func", yinterval); /* evaluate integral on [0, 1] */&lt;/P&gt;&lt;P&gt;val&lt;I&gt; = result;&lt;/I&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Jul 2014 14:04:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Product-of-functions-Variable-scope/m-p/179922#M1793</guid>
      <dc:creator>Hutch_sas</dc:creator>
      <dc:date>2014-07-15T14:04:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to aggregate a tree efficiently?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-aggregate-a-tree-efficiently/m-p/178968#M1779</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What operations do you need to do on the tree? Do you need to be able to add/delete nodes or prune branches? How is the tree to be constructed?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Jul 2014 13:39:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-aggregate-a-tree-efficiently/m-p/178968#M1779</guid>
      <dc:creator>Hutch_sas</dc:creator>
      <dc:date>2014-07-15T13:39:45Z</dc:date>
    </item>
    <item>
      <title>Re: compute a formula</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/compute-a-formula/m-p/176386#M1737</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For a 4th degree poynomial there will be generally 4 complex solutions. Looks like the polyroot() function&amp;nbsp; is what you need, check the IML documentation. I suggest you first compute z = polyroot( {1.2 1.2 1.2 1.2 -10) to get the imaginary roots, then&amp;nbsp; since z = 1 + x, x = z-1, just subtract 1 from the first column of z to get x, i. e.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc iml;&lt;/P&gt;&lt;P&gt;a = {1.2 1.2 1.2 1.2 -10};&lt;/P&gt;&lt;P&gt;z = polyroot(a);&lt;/P&gt;&lt;P&gt;x = z - {1 0,1 0,1 0,1 0};&lt;/P&gt;&lt;P&gt;print x;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Jul 2014 16:52:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/compute-a-formula/m-p/176386#M1737</guid>
      <dc:creator>Hutch_sas</dc:creator>
      <dc:date>2014-07-11T16:52:32Z</dc:date>
    </item>
    <item>
      <title>Re: Computational Accuracy and Efficiency for the NLPNMS</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Computational-Accuracy-and-Efficiency-for-the-NLPNMS/m-p/160268#M1481</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The other default values seem to be in line with the 9.1 doc, so there could be an error in the documentation regarding that parameter. It might be helpful if you shared your program, to verify your setup for the optimization.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Jul 2014 14:33:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Computational-Accuracy-and-Efficiency-for-the-NLPNMS/m-p/160268#M1481</guid>
      <dc:creator>Hutch_sas</dc:creator>
      <dc:date>2014-07-01T14:33:15Z</dc:date>
    </item>
    <item>
      <title>Re: Computational Accuracy and Efficiency for the NLPNMS</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Computational-Accuracy-and-Efficiency-for-the-NLPNMS/m-p/160266#M1479</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There are many different ways tolook at computational efficiency. The Nelder-Mead simplex algorithm, because it does not use gradients directly, may require more objective function evaluations than some other techniques such as the conguate gradient method. However, the computation of gradients and Hessians can sometimes be very cpu-intensive themselves, so the least cpu-intensive method generally depends on the problem constraints and objective function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are also several ways to estimate the accuracy of the results. Look at the SAS/IML doc under Nonlinear Optimization Examples-&amp;gt;Details-&amp;gt;Termination Criteria. IML provides several options for terminating the optimization process for NLPNMS, based on the relative or absolute change in value of either the objective function or the parameters between iterations of the algorithm, and that should give you some estimate of the accuracy of the results. Obviously, the tighter the termination criteria, the more iterations will be required. Since your input data or model iteslf is probably not exact in the first place, requiring extreme accuracy may not be justified and can lead to excessive run times or numerical problems. Keep in mind also that all the nlp methods will converge to a local optimum, so unless your objective function is complex it is possible that your answer might not always be the global one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jun 2014 13:42:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Computational-Accuracy-and-Efficiency-for-the-NLPNMS/m-p/160266#M1479</guid>
      <dc:creator>Hutch_sas</dc:creator>
      <dc:date>2014-06-30T13:42:26Z</dc:date>
    </item>
    <item>
      <title>Re: using nlpcg in sas iml</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/using-nlpcg-in-sas-iml/m-p/136457#M1100</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Could you post your current program, and your run-time log?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jun 2014 12:35:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/using-nlpcg-in-sas-iml/m-p/136457#M1100</guid>
      <dc:creator>Hutch_sas</dc:creator>
      <dc:date>2014-06-12T12:35:57Z</dc:date>
    </item>
    <item>
      <title>Re: using nlpcg in sas iml</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/using-nlpcg-in-sas-iml/m-p/136455#M1098</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The problem is that when IML calls your objective function during the optimization, it is supplying a row vector for x. Try transposing x in the second line of your objective module, i.e.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum= m [,2:3]*x` + m [,1];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and see if that doesn't work as it is supposed to.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jun 2014 20:15:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/using-nlpcg-in-sas-iml/m-p/136455#M1098</guid>
      <dc:creator>Hutch_sas</dc:creator>
      <dc:date>2014-06-10T20:15:44Z</dc:date>
    </item>
    <item>
      <title>Re: maximization in proc iml with global variable</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/maximization-in-proc-iml-with-global-variable/m-p/174181#M1721</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Could you give us or point us to a complete mathematical description of your problem? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 May 2014 12:09:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/maximization-in-proc-iml-with-global-variable/m-p/174181#M1721</guid>
      <dc:creator>Hutch_sas</dc:creator>
      <dc:date>2014-05-28T12:09:40Z</dc:date>
    </item>
    <item>
      <title>Re: maximization in proc iml with global variable</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/maximization-in-proc-iml-with-global-variable/m-p/174177#M1717</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You did not define r. The objective function uses r, so if it is not defined it will give you an error.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 May 2014 16:01:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/maximization-in-proc-iml-with-global-variable/m-p/174177#M1717</guid>
      <dc:creator>Hutch_sas</dc:creator>
      <dc:date>2014-05-27T16:01:11Z</dc:date>
    </item>
    <item>
      <title>Re: subroutine</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/subroutine/m-p/141596#M1188</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;proc iml;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;start AddToDiag( result, A, B);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* add B to diagonal of a square matrix A */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; result = A + diag(&amp;nbsp; j(nrow(A),&amp;nbsp; 1,&amp;nbsp;&amp;nbsp; B)&amp;nbsp; );&lt;/P&gt;&lt;P&gt;finish;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* test it out */&lt;/P&gt;&lt;P&gt;m = {1 1 1,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2 2 2,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3 3 3 };&lt;/P&gt;&lt;P&gt;lambda = 3;&lt;/P&gt;&lt;P&gt;run AddToDiag( MPlusLambda, m, lambda);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;print M lambda MPlusLambda;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 May 2014 12:21:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/subroutine/m-p/141596#M1188</guid>
      <dc:creator>Hutch_sas</dc:creator>
      <dc:date>2014-05-02T12:21:29Z</dc:date>
    </item>
    <item>
      <title>Re: matrices</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/matrices/m-p/140915#M1153</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A quick way to add a constant to the diagonal elements of a matrix:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* add B to diagonal of a square matrix A */&lt;/P&gt;&lt;P&gt;C = A + diag(&amp;nbsp; j(nrow(A),&amp;nbsp; 1,&amp;nbsp;&amp;nbsp; B)&amp;nbsp; );&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 May 2014 19:26:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/matrices/m-p/140915#M1153</guid>
      <dc:creator>Hutch_sas</dc:creator>
      <dc:date>2014-05-01T19:26:13Z</dc:date>
    </item>
    <item>
      <title>Re: A Problem with NLPNMS when using Modules with random generations</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/A-Problem-with-NLPNMS-when-using-Modules-with-random-generations/m-p/183518#M1852</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oops, I missed the fact that you were still at 9.0.&amp;nbsp; RANDGEN and RANDSEED were introduced in 9.1. I don't believe the old random number generation functions allow the arbitrary re-initialization of the random number stream. In order to get the same sampling, you will have to create a table of random variates at the beginning of your program, and re-use that stream at each call. If you need more samples than can be stored in memory, you might have to store them in a data set and read them in as called for.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Apr 2014 13:38:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/A-Problem-with-NLPNMS-when-using-Modules-with-random-generations/m-p/183518#M1852</guid>
      <dc:creator>Hutch_sas</dc:creator>
      <dc:date>2014-04-21T13:38:57Z</dc:date>
    </item>
    <item>
      <title>Re: A Problem with NLPNMS when using Modules with random generations</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/A-Problem-with-NLPNMS-when-using-Modules-with-random-generations/m-p/183516#M1850</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;After you posted your code, I tried running your objective function a few times. As one would expect, it gives slightly different answers if you run it with the same input multiple times, because the random number stream is different each time the objective function or non-linear constraint function is evaluated. This can be easily fixed. Instead of calling the NORMAL function each time for your objective and constraint functions, use the newer RANDGEN call. You can then re-set the random number seed to the same value by calling RANDSEED at the beginning of each objective/constraint module call, guaranteeing that you use the same random number stream each time. I also noticed that you could hoist a couple of operations outside your inner loop to marginally improve performance. I made these changes in your program, and it ran in about 3 hrs on my PC. I pasted it in below. Give it a try and see if you get better results. I also recommend that you try some different seeds in the RANDSEED call to see how sensitive your results are to the choice of random seed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc iml;&lt;BR /&gt;&amp;nbsp; start ARL(hr);&lt;BR /&gt;&amp;nbsp; call randseed(1000,1);&lt;BR /&gt;&amp;nbsp; shift=0.5;&lt;/P&gt;&lt;P&gt;&amp;nbsp; * p is number of variables;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; p=2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; * nruns is the number of simulation runs;&lt;/P&gt;&lt;P&gt;&amp;nbsp; nruns=100000;&lt;/P&gt;&lt;P&gt;&amp;nbsp; arlv=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp; sh=shift//j(p-1,1,0); /* sh unchanged throughout the simulation */&lt;BR /&gt;&amp;nbsp; x = j(p,1); /* set up x with proper dimensions, just once */&lt;/P&gt;&lt;P&gt; * starting the simulation;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do reps=1 to nruns;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rl=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *initialy z is set as a px1 vector of zeros;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; z=0//j(p-1,1,0);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; *ti carries the sum of squares of z, i.e, each element of z is squared and then we take the sum;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ti=ssq(z);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; do until (ti&amp;gt;hr[1]);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *generating p univariate standard normal variables;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; call randgen(x, 'normal');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *adding the shift for the out of control case;&lt;BR /&gt;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; x=x+sh;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *computing the norm of the error;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ei=sqrt(ssq(x-z));&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ei&amp;gt;hr[3] then &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; w=(ei-(1-hr[2])*hr[3])/ei;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; w=hr[2];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; z=(1-w)*z+w*x;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ti=ssq(z);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rl=rl+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arlv=arlv+rl;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; arlr=arlv/nruns;&lt;/P&gt;&lt;P&gt;&amp;nbsp; bb=arlr;&lt;/P&gt;&lt;P&gt;&amp;nbsp; return(bb);&lt;/P&gt;&lt;P&gt;&amp;nbsp; finish;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; start ARL0(hry)global(hr); &lt;/P&gt;&lt;P&gt;&amp;nbsp; hr=hry;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; call randseed(1000,1);&lt;/P&gt;&lt;P&gt;&amp;nbsp; shift=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; bb0=j(1,1,0.);&lt;/P&gt;&lt;P&gt;&amp;nbsp; p=2;&lt;BR /&gt; sh=shift//j(p-1,1,0); /* sh unchanged throughout the simulation */&lt;BR /&gt;&amp;nbsp; x = j(p,1); /* set up x with propoer dimensions, just once */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; * nruns is the number of simulation runs;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; nruns=100000;&lt;/P&gt;&lt;P&gt;&amp;nbsp; arlv=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; * starting the simulation;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; do reps=1 to nruns;&lt;/P&gt;&lt;P&gt;&amp;nbsp; rl=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp; *initialy z is set as a px1 vector Of zeros;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; z=0//j(p-1,1,0);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; *ti carries the sum of squares of Z, i.e, each element of z is squared and then we take the sum;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; ti=ssq(z);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; do until (ti&amp;gt;hr[1]);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; *generating p univariate standard normal variables;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; call randgen(x,'normal');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; *adding the shift for the out of control case;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp; x=x+sh;&lt;/P&gt;&lt;P&gt;&amp;nbsp; *computing the norm of the error;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ei=sqrt(ssq(x-z));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ei&amp;gt;hr[3] then w=(ei-(1-hr[2])*hr[3])/ei;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else w=hr[2];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; z=(1-w)*z+w*x;&lt;/P&gt;&lt;P&gt; ti=ssq(z);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rl=rl+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end; &lt;/P&gt;&lt;P&gt;&amp;nbsp; arlv=arlv+rl;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; arlr=arlv/nruns;&lt;/P&gt;&lt;P&gt;&amp;nbsp; bb0[1]=(arlr)-200;&lt;/P&gt;&lt;P&gt; return(bb0);&lt;/P&gt;&lt;P&gt;&amp;nbsp; finish; &lt;/P&gt;&lt;P&gt;&amp;nbsp; con = {&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp; 0,&amp;nbsp; &lt;/P&gt;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp; . };&lt;/P&gt;&lt;P&gt; *initial vector;&lt;/P&gt;&lt;P&gt; hr={0.8856&amp;nbsp; 0.17&amp;nbsp; 3.85};&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; optn= j(1,11,.);optn[2]=5;optn[10]=1;optn[11]=0;&lt;/P&gt;&lt;P&gt;CALL NLPNMS(rc,hrres,"ARL",hr) blc=con opt=optn nlc="ARL0";&lt;BR /&gt;print hrres;&lt;/P&gt;&lt;P&gt;&amp;nbsp; quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 20 Apr 2014 16:30:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/A-Problem-with-NLPNMS-when-using-Modules-with-random-generations/m-p/183516#M1850</guid>
      <dc:creator>Hutch_sas</dc:creator>
      <dc:date>2014-04-20T16:30:39Z</dc:date>
    </item>
  </channel>
</rss>

