<?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: Assistance with PROC OPTMODEL in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/Assistance-with-PROC-OPTMODEL/m-p/532021#M2587</link>
    <description>&lt;P&gt;The syntax you've written is not valid for several reasons, all having to do with the macro processing.&lt;/P&gt;
&lt;OL style="list-style-position: inside;"&gt;
&lt;LI&gt;The %DO macro loop is missing a semicolon&lt;/LI&gt;
&lt;LI&gt;The END statement should presumably be %END?&lt;/LI&gt;
&lt;LI&gt;You can't use a %DO macro loop in open code. It has to be part of a function-style macro (%MACRO/%MEND)&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Please describe in words what you are trying to accomplish so we can advise the best way to do it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 01 Feb 2019 14:51:32 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2019-02-01T14:51:32Z</dc:date>
    <item>
      <title>Assistance with PROC OPTMODEL</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Assistance-with-PROC-OPTMODEL/m-p/531891#M2586</link>
      <description>&lt;P&gt;my code is not working. It is showing an error of unknown c1, c2, c3, c4, and so unknown f. Please help me out. Thanks&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data x (drop = i);
do i = 1 to 100;
c1 = ranuni(i);
c2 = ranuni(i);
c3 = ranuni(i);
c4 = ranuni(i);
output;
end;
run;

proc print data = x;var c1 c2 c3 c4;run;

proc optmodel;
var a;
var b;
%do i = 1 %to dim(x)
minimize f =(((1-((c1[i]*a+c2[i]*b)/30.9))**2)*1.08)+(((1-((c3[i]*a+c4[i]*b)/12.8))**2)*1);
con P: a+b=1.0;
con Q: a &amp;gt;= 0.0;
con R: b &amp;gt;= 0.0;
con T: a &amp;lt;= 1.0;
con U: b &amp;lt;=1.0;
solve with qp;

/* print the optimal solution */
print a b;
print f;
quit;
end;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;var b;&lt;BR /&gt;%do i = 1 %to dim(x)&lt;BR /&gt;minimize f =(((1-((c1[i]*a+c2[i]*b)/30.9))**2)*1.08)+(((1-((c3[i]*a+c4[i]*b)/12.8))**2)*1);&lt;BR /&gt;con P: a+b=1.0;&lt;BR /&gt;con Q: a &amp;gt;= 0.0;&lt;BR /&gt;con R: b &amp;gt;= 0.0;&lt;BR /&gt;con T: a &amp;lt;= 1.0;&lt;BR /&gt;con U: b &amp;lt;=1.0;&lt;BR /&gt;solve with qp;&lt;/P&gt;&lt;P&gt;/* print the optimal solution */&lt;BR /&gt;print a b;&lt;BR /&gt;print f;&lt;BR /&gt;quit;&lt;BR /&gt;end;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Feb 2019 05:31:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Assistance-with-PROC-OPTMODEL/m-p/531891#M2586</guid>
      <dc:creator>hzk0065</dc:creator>
      <dc:date>2019-02-01T05:31:57Z</dc:date>
    </item>
    <item>
      <title>Re: Assistance with PROC OPTMODEL</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Assistance-with-PROC-OPTMODEL/m-p/532021#M2587</link>
      <description>&lt;P&gt;The syntax you've written is not valid for several reasons, all having to do with the macro processing.&lt;/P&gt;
&lt;OL style="list-style-position: inside;"&gt;
&lt;LI&gt;The %DO macro loop is missing a semicolon&lt;/LI&gt;
&lt;LI&gt;The END statement should presumably be %END?&lt;/LI&gt;
&lt;LI&gt;You can't use a %DO macro loop in open code. It has to be part of a function-style macro (%MACRO/%MEND)&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Please describe in words what you are trying to accomplish so we can advise the best way to do it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Feb 2019 14:51:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Assistance-with-PROC-OPTMODEL/m-p/532021#M2587</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2019-02-01T14:51:32Z</dc:date>
    </item>
    <item>
      <title>Re: Assistance with PROC OPTMODEL</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Assistance-with-PROC-OPTMODEL/m-p/532027#M2588</link>
      <description>Thanks for reply,&lt;BR /&gt;I am trying to write a minimize function for a and b using any random values of c1-c4 between 1 to 100. In the minimize function, corresponding values of the same row for all c1-c4 will go as input and it will repeat for all 100 rows. The value of a and b supposed to be close to 1 and 0 respectively. I hope it is clear now? Please let me know if you have any questions?&lt;BR /&gt;Thanks</description>
      <pubDate>Fri, 01 Feb 2019 15:02:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Assistance-with-PROC-OPTMODEL/m-p/532027#M2588</guid>
      <dc:creator>hzk0065</dc:creator>
      <dc:date>2019-02-01T15:02:49Z</dc:date>
    </item>
    <item>
      <title>Re: Assistance with PROC OPTMODEL</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Assistance-with-PROC-OPTMODEL/m-p/532037#M2589</link>
      <description>It sounds like you want to mimic this SAS Usage Note: &lt;A href="http://support.sas.com/kb/42/332.html" target="_blank"&gt;http://support.sas.com/kb/42/332.html&lt;/A&gt;</description>
      <pubDate>Fri, 01 Feb 2019 15:25:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Assistance-with-PROC-OPTMODEL/m-p/532037#M2589</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2019-02-01T15:25:24Z</dc:date>
    </item>
  </channel>
</rss>

