<?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: variables in nested modules in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/variables-in-nested-modules/m-p/162325#M1545</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;By the way, your LS function doesn't have a unique minimum. It has a trough, which will probably result in the optimization step not converging. Notice that the gradient of LS is&lt;/P&gt;&lt;P&gt;start grdLS(a) global(dp, x1,x2);&lt;/P&gt;&lt;P&gt;&amp;nbsp; return( -x1 || -x2 );&lt;/P&gt;&lt;P&gt;finish;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The gradient is a constant vector, so it never vanishes unless x1 and x2 are identically zero.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 08 Nov 2014 11:31:11 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2014-11-08T11:31:11Z</dc:date>
    <item>
      <title>variables in nested modules</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/variables-in-nested-modules/m-p/162323#M1543</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I run the code to optimizing loglikelihood&amp;nbsp; like the following in SAS9.2/IML:&lt;/P&gt;&lt;P&gt;start ML (x) ;&lt;/P&gt;&lt;P&gt;dp=1;x1=2;,x2=3;&lt;/P&gt;&lt;P&gt;star ls(a) global(dp, x1,x2);&lt;/P&gt;&lt;P&gt;z=SSQ(dp-a[1]#x1-a[2]#x2);&lt;/P&gt;&lt;P&gt;return(z);&lt;/P&gt;&lt;P&gt;finish LS;&lt;/P&gt;&lt;P&gt;x={3 3};&lt;/P&gt;&lt;P&gt;call nlpnrr(rc,rx,"LS",x);&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;finish ML;&lt;/P&gt;&lt;P&gt;x={0,1};&lt;/P&gt;&lt;P&gt;call nlpnms(rc,xr,"ML",x);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;there is a error message in log window as following:&lt;/P&gt;&lt;P&gt;ERROR: (execution) Matrix has not been set to a value.&lt;/P&gt;&lt;P&gt; operation : # at line 1803 column 30&lt;BR /&gt; operands&amp;nbsp; : _TEM1001, x1&lt;/P&gt;&lt;P&gt;_TEM1001&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 row&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 col&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (numeric)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&lt;/P&gt;&lt;P&gt;x1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 row&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 col&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (type ?, size 0)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; statement : ASSIGN at line 1803 column 17&lt;BR /&gt; traceback : module LS at line 1803 column 17&lt;BR /&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; module ML at line 1635 column 1&lt;/P&gt;&lt;P&gt;ERROR: (execution) Matrix has not been set to a value.&lt;/P&gt;&lt;P&gt; operation : NLPNRR at line 1686 column 16&lt;BR /&gt; operands&amp;nbsp; : *LIT1074, x, , con&lt;/P&gt;&lt;P&gt;*LIT1074&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 row&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 col&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (character, size 2)&lt;/P&gt;&lt;P&gt; ls&lt;/P&gt;&lt;P&gt;x&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 row&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2 cols&amp;nbsp;&amp;nbsp;&amp;nbsp; (numeric)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&lt;/P&gt;&lt;P&gt;con&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2 rows&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2 cols&amp;nbsp;&amp;nbsp;&amp;nbsp; (numeric)&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; .&lt;BR /&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; 50&lt;/P&gt;&lt;P&gt; statement : CALL at line 1686 column 16&lt;BR /&gt; traceback : module ML at line 1686 column 16&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When&amp;nbsp; i use&amp;nbsp; a Global clause in Start ML(x) as&lt;/P&gt;&lt;P&gt; Start ML(x) Global(dp, x1,x2);&lt;/P&gt;&lt;P&gt;there is not error message.&lt;/P&gt;&lt;P&gt;My question is :&lt;/P&gt;&lt;P&gt; Since x1 and x2 are defined with global clause in moldule ML before model LS, they are global variables for module LS, Why error message say that? What's the function of the Global clause in "Start ML(x) Global&lt;/P&gt;&lt;P&gt;(dp, x1,x2);"&lt;/P&gt;&lt;P&gt;Thanks alot!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 08 Nov 2014 08:39:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/variables-in-nested-modules/m-p/162323#M1543</guid>
      <dc:creator>ShufeGuoding</dc:creator>
      <dc:date>2014-11-08T08:39:48Z</dc:date>
    </item>
    <item>
      <title>Re: variables in nested modules</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/variables-in-nested-modules/m-p/162324#M1544</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There is no such thing as a nested module. All modules are known globally. If you want to share variable names between two modules, you can use the GLOBAL statement on each START statement. In your case, you would use&lt;/P&gt;&lt;P&gt;global(dp, x1,x2);&lt;/P&gt;&lt;P&gt;for both the ML and LS modules.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; For details, see the article &lt;A href="http://blogs.sas.com/content/iml/2014/04/21/local-functions-not-in-the-sasiml-langauge/" title="http://blogs.sas.com/content/iml/2014/04/21/local-functions-not-in-the-sasiml-langauge/"&gt; Local functions (not!) in the SAS/IML language - The DO Loop&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 08 Nov 2014 11:14:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/variables-in-nested-modules/m-p/162324#M1544</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2014-11-08T11:14:26Z</dc:date>
    </item>
    <item>
      <title>Re: variables in nested modules</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/variables-in-nested-modules/m-p/162325#M1545</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;By the way, your LS function doesn't have a unique minimum. It has a trough, which will probably result in the optimization step not converging. Notice that the gradient of LS is&lt;/P&gt;&lt;P&gt;start grdLS(a) global(dp, x1,x2);&lt;/P&gt;&lt;P&gt;&amp;nbsp; return( -x1 || -x2 );&lt;/P&gt;&lt;P&gt;finish;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The gradient is a constant vector, so it never vanishes unless x1 and x2 are identically zero.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 08 Nov 2014 11:31:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/variables-in-nested-modules/m-p/162325#M1545</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2014-11-08T11:31:11Z</dc:date>
    </item>
  </channel>
</rss>

