<?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: Passing a macro to an optimizer in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Passing-a-macro-to-an-optimizer/m-p/105420#M29410</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't think you can pass a macro function to a SAS optimizer. Proc NLP however can accomodate most datastep statements. It can also call your own function defined with proc FCMP. If your dataset was smaller (1k instead of 10k observations, say), I would be almost certain it could work, because you could polulate constant arrays inside NLP or FCMP with macro variables. But 10k floating point numbers cannot be listed within the size limit of a macro string (64k characters).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 07 May 2012 02:21:19 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2012-05-07T02:21:19Z</dc:date>
    <item>
      <title>Passing a macro to an optimizer</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Passing-a-macro-to-an-optimizer/m-p/105418#M29408</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;I have both SAS/OR and SAS/IML and would like to perform nonlinear optimization on the values returned by a macro. This macro takes A and B as input and returns a result specific for the A and B values. There are also lower and upper bounds on both A and B, I have given a pseudo code that explains this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;MACRO returnResult(A, B)&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;{&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; ...................................&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; ...................................&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; ...................................&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; result = function (A, B)&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;The objective function to minimized is the "result" returned by the macro with upper and lower bounds on A and B. Can some please help how we can set it up as a nonlinear optimization problem using SAS/OR or SAS/IML?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Ravi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 06 May 2012 08:04:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Passing-a-macro-to-an-optimizer/m-p/105418#M29408</guid>
      <dc:creator>vioravis</dc:creator>
      <dc:date>2012-05-06T08:04:07Z</dc:date>
    </item>
    <item>
      <title>Re: Passing a macro to an optimizer</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Passing-a-macro-to-an-optimizer/m-p/105419#M29409</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Specifically, if I have a macro that contains the following data steps that calculates the objective function, is it possible to use them with in either PROC IML or OPTMODEL (I am new to both). Any help would be appreciated. Thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*create some test data*/&lt;/P&gt;&lt;P&gt;DATA test (drop=i);&lt;/P&gt;&lt;P&gt;&amp;nbsp; input X Y Z;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do i=1 to 2000;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;1 10 0&lt;/P&gt;&lt;P&gt;2 20 0&lt;/P&gt;&lt;P&gt;3 30 0&lt;/P&gt;&lt;P&gt;4 40 0&lt;/P&gt;&lt;P&gt;5 50 0&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;if 0 then set test nobs=nobs;&lt;/P&gt;&lt;P&gt;CALL SYMPUT('NUMREC',nobs);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*** put # of records into NUMREC macro var ***/&lt;/P&gt;&lt;P&gt;stop;&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;&amp;nbsp;&amp;nbsp; /*** stop, got number of records ***/&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* now read values of x and y into arrays, and then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; reread test and do calculations*/&lt;/P&gt;&lt;P&gt;data want (drop=_:);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; array _xval(&amp;amp;numrec); /* create two arrays with same number of&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;&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; elements as there are records in test&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; array _yval(&amp;amp;numrec);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; i=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; do until (eof1);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* load the array with x and y values */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set test end=eof1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _xval(i)=x;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _yval(i)=y;&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; _rec=-1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; do until (eof2);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* read in each record separately */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set test end=eof2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _rec+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; z=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do _i=1 to _rec;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; z+_xval(_i)*_yval(&amp;amp;numrec-_rec+_i);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The above data steps are discussed in : &lt;A _jive_internal="true" href="https://communities.sas.com/message/109827#109827"&gt;https://communities.sas.com/message/109827#109827&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ravi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 06 May 2012 19:06:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Passing-a-macro-to-an-optimizer/m-p/105419#M29409</guid>
      <dc:creator>vioravis</dc:creator>
      <dc:date>2012-05-06T19:06:00Z</dc:date>
    </item>
    <item>
      <title>Re: Passing a macro to an optimizer</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Passing-a-macro-to-an-optimizer/m-p/105420#M29410</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't think you can pass a macro function to a SAS optimizer. Proc NLP however can accomodate most datastep statements. It can also call your own function defined with proc FCMP. If your dataset was smaller (1k instead of 10k observations, say), I would be almost certain it could work, because you could polulate constant arrays inside NLP or FCMP with macro variables. But 10k floating point numbers cannot be listed within the size limit of a macro string (64k characters).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 May 2012 02:21:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Passing-a-macro-to-an-optimizer/m-p/105420#M29410</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2012-05-07T02:21:19Z</dc:date>
    </item>
    <item>
      <title>Re: Passing a macro to an optimizer</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Passing-a-macro-to-an-optimizer/m-p/105421#M29411</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hi PGStats,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot for your reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to use the quasi Newton optimization approach in PROC IML and trying to use submit/endsubmit to define the objective function. However, I am having difficulty passing the values generated within submit/endsubmit outside of it.I have give an example code below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this code, SUMM calculated using PROC SQL is added to the objective function (this just for a demo only). This code throws an error "Apparent Symbolic Reference SUMM not resolved".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can someone help me with how to get the value of SUMM work outside submit/endsubmit?? Also, this procedure seems exteremely slow (since my calculation of objective functin contains several data steps and a few do loops). Is there an alternative way to perform similar optimization more efficiently??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 10pt; font-family: 'Courier New';"&gt;iml&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;start&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; F_ROSEN(x);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: red; font-size: 10pt;"&gt;submit&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG style="color: navy; font-size: 10pt; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; test; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; x;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;datalines&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.3&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2.9&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG style="color: navy; font-size: 10pt; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;STRONG style="color: navy; font-size: 10pt; font-family: 'Courier New';"&gt;PROC&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 10pt; font-family: 'Courier New';"&gt;SQL&lt;/STRONG&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;NOPRINT&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;SELECT&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; SUM(x) &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;into&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; :SUMM&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; font-size: 10pt;"&gt;FROM&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;STRONG style="color: navy; font-size: 10pt; font-family: 'Courier New';"&gt;QUIT&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-family: 'Courier New'; color: red; font-size: 10pt;"&gt;endsubmit&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; y1 = &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; font-family: 'Courier New';"&gt;10&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; * (x[&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; font-family: 'Courier New';"&gt;2&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;] - x[&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;] * x[&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;]);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; y2 =&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; - x[&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;];&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; f&amp;nbsp; = &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; font-family: 'Courier New';"&gt;0.5&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; * (y1 * y1 + y2 * y2)+&amp;amp;SUMM;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return(f);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: red; font-size: 10pt;"&gt;finish&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; F_ROSEN;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp; x = {-&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; font-family: 'Courier New';"&gt;1.2&lt;/STRONG&gt; &lt;STRONG style="color: teal; font-size: 10pt; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;};&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp; optn = {&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; font-family: 'Courier New';"&gt;0&lt;/STRONG&gt; &lt;STRONG style="color: teal; font-size: 10pt; font-family: 'Courier New';"&gt;2&lt;/STRONG&gt; &lt;STRONG style="color: teal; font-size: 10pt; font-family: 'Courier New';"&gt;.&lt;/STRONG&gt; &lt;STRONG style="color: teal; font-size: 10pt; font-family: 'Courier New';"&gt;2&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;};&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: red; font-size: 10pt;"&gt;call&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; nlpqn(rc,xr,&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: purple; font-size: 10pt;"&gt;"F_ROSEN"&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;,x,optn);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; font-family: 'Courier New';"&gt;quit&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ravi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 May 2012 16:23:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Passing-a-macro-to-an-optimizer/m-p/105421#M29411</guid>
      <dc:creator>vioravis</dc:creator>
      <dc:date>2012-05-07T16:23:37Z</dc:date>
    </item>
    <item>
      <title>Re: Passing a macro to an optimizer</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Passing-a-macro-to-an-optimizer/m-p/105422#M29412</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think I understand what the issue is now. SUMM is getting treated as a third decision variable in the optimization since&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;f&amp;nbsp; = &lt;STRONG style="font-family: 'Courier New'; color: teal; font-size: 10pt;"&gt;0.5&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; * (y1 * y1 + y2 * y2)+&amp;amp;SUMM;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;This works only if I declare x = {-1.2 1 1} i.e. provide the starting point for the third decision variable (SUMM) as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, in my actual problem, I will only define f = &amp;amp;SUMM since SUMM is the result of the objective function (like squared errors) for a specific value of x1 and x2. f will not contain any references to x1 or x2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Doing this throws an error after the line x = {-&lt;STRONG style="font-family: 'Courier New'; color: teal; font-size: 10pt;"&gt;1.2&lt;/STRONG&gt; &lt;STRONG style="font-family: 'Courier New'; color: teal; font-size: 10pt;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;} &lt;/SPAN&gt; that "Undeclared array referenced: x"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it possible to call the optimizing function with f defined in this way???&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help on this would be appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ravi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 May 2012 20:44:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Passing-a-macro-to-an-optimizer/m-p/105422#M29412</guid>
      <dc:creator>vioravis</dc:creator>
      <dc:date>2012-05-07T20:44:23Z</dc:date>
    </item>
  </channel>
</rss>

