<?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: For loop in PROC OPTMODEL in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/For-loop-in-PROC-OPTMODEL/m-p/197389#M997</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you want sigtsq to depend on decision variables, you should declare it as an implicit variable:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 12pt; font-family: Courier New;"&gt;impvar&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt; sigtsq {j in &lt;/SPAN&gt;&lt;STRONG style=": ; color: #008080; font-size: 12pt; font-family: Courier New;"&gt;1..n&lt;/STRONG&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;} = &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (if j = &lt;/SPAN&gt;&lt;STRONG style=": ; color: #008080; font-size: 12pt; font-family: Courier New;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt; then mean(of epsilonsq&lt;LI&gt;) else omega + alpha*epsilonsq[j-&lt;/LI&gt;&lt;/SPAN&gt;&lt;STRONG style=": ; color: #008080; font-size: 12pt; font-family: Courier New;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;] + beta*sigtsq[j-&lt;/SPAN&gt;&lt;STRONG style=": ; color: #008080; font-size: 12pt; font-family: Courier New;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;]);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See the IMPVAR statement in the PROC OPTMODEL documentation:&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/ormpug/67517/HTML/default/viewer.htm#ormpug_optmodel_syntax03.htm" title="http://support.sas.com/documentation/cdl/en/ormpug/67517/HTML/default/viewer.htm#ormpug_optmodel_syntax03.htm"&gt;SAS/OR(R) 13.2 User's Guide: Mathematical Programming&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 01 Jun 2015 18:52:05 GMT</pubDate>
    <dc:creator>RobPratt</dc:creator>
    <dc:date>2015-06-01T18:52:05Z</dc:date>
    <item>
      <title>For loop in PROC OPTMODEL</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/For-loop-in-PROC-OPTMODEL/m-p/197388#M996</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am a newbie in sas and trying to write a simplistic version of garch model in proc optmodel, here is the attached code,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc optmodel;&lt;/P&gt;&lt;P&gt;number n = 8926;&lt;/P&gt;&lt;P&gt;/* var omega init 0.01, alpha init 0.02, beta init 0.92; */&lt;/P&gt;&lt;P&gt; var omega, alpha, beta, mu;&lt;/P&gt;&lt;P&gt;number epsilonsq{1..n}, y{1..n}, llh{1..n}, sigtsq{1..n};&lt;/P&gt;&lt;P&gt;read data ret into [_n_] y; llh[1] = 0;&lt;/P&gt;&lt;P&gt;for{i in 1..n} do; epsilonsq&lt;I&gt; = (y&lt;I&gt;-0.0005)**2; end; &lt;/I&gt;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;sigtsq[1] = mean(of epsilonsq&lt;LI&gt;);&lt;/LI&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for{j in 2..n} do;&lt;/P&gt;&lt;P&gt;&amp;nbsp; sigtsq&lt;J&gt; = omega + alpha*epsilonsq[j-1] + beta*sigtsq[j-1];&amp;nbsp; end;&lt;/J&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;min z = sum{k in 2..n}(0.5*(log(2*3.14156) &lt;/P&gt;&lt;P&gt;&amp;nbsp; + log(omega + alpha*epsilonsq[k-1] + beta*sigtsq[k-1]) &lt;/P&gt;&lt;P&gt;&amp;nbsp; + epsilonsq&lt;K&gt;/(omega + alpha*epsilonsq[k-1] + beta*sigtsq[k-1])));&lt;/K&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;omega.lb = 1e-06; alpha.lb = 1e-06; beta.lb = 1e-06;&lt;/P&gt;&lt;P&gt;omega.ub = 1-1e-06; alpha.ub = 1-1e-06; beta.ub = 1-1e-06;&lt;/P&gt;&lt;P&gt;con c: alpha + beta &amp;lt;= 1-1e-06;&lt;/P&gt;&lt;P&gt;solve with nlp / tech=ip; print sigtsq;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want sigstq matrix (its defined as an array using the number declaration) to change as the parameters (omega, alpha, beta) changes at every step of optimization. However, it remains constant throughout the optimization.&lt;/P&gt;&lt;P&gt;Please point me in the right direction. Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Jun 2015 18:30:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/For-loop-in-PROC-OPTMODEL/m-p/197388#M996</guid>
      <dc:creator>sasuser2417</dc:creator>
      <dc:date>2015-06-01T18:30:31Z</dc:date>
    </item>
    <item>
      <title>Re: For loop in PROC OPTMODEL</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/For-loop-in-PROC-OPTMODEL/m-p/197389#M997</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you want sigtsq to depend on decision variables, you should declare it as an implicit variable:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 12pt; font-family: Courier New;"&gt;impvar&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt; sigtsq {j in &lt;/SPAN&gt;&lt;STRONG style=": ; color: #008080; font-size: 12pt; font-family: Courier New;"&gt;1..n&lt;/STRONG&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;} = &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (if j = &lt;/SPAN&gt;&lt;STRONG style=": ; color: #008080; font-size: 12pt; font-family: Courier New;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt; then mean(of epsilonsq&lt;LI&gt;) else omega + alpha*epsilonsq[j-&lt;/LI&gt;&lt;/SPAN&gt;&lt;STRONG style=": ; color: #008080; font-size: 12pt; font-family: Courier New;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;] + beta*sigtsq[j-&lt;/SPAN&gt;&lt;STRONG style=": ; color: #008080; font-size: 12pt; font-family: Courier New;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;]);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See the IMPVAR statement in the PROC OPTMODEL documentation:&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/ormpug/67517/HTML/default/viewer.htm#ormpug_optmodel_syntax03.htm" title="http://support.sas.com/documentation/cdl/en/ormpug/67517/HTML/default/viewer.htm#ormpug_optmodel_syntax03.htm"&gt;SAS/OR(R) 13.2 User's Guide: Mathematical Programming&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Jun 2015 18:52:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/For-loop-in-PROC-OPTMODEL/m-p/197389#M997</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2015-06-01T18:52:05Z</dc:date>
    </item>
    <item>
      <title>Re: For loop in PROC OPTMODEL</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/For-loop-in-PROC-OPTMODEL/m-p/197390#M998</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Rob!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Jun 2015 19:09:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/For-loop-in-PROC-OPTMODEL/m-p/197390#M998</guid>
      <dc:creator>sasuser2417</dc:creator>
      <dc:date>2015-06-01T19:09:48Z</dc:date>
    </item>
    <item>
      <title>Re: For loop in PROC OPTMODEL</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/For-loop-in-PROC-OPTMODEL/m-p/197391#M999</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Glad to help.&amp;nbsp; You might also be interested in this book of 29 examples that illustrate various features of PROC OPTMODEL:&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/ormpex/67518/HTML/default/viewer.htm#titlepage.htm" title="http://support.sas.com/documentation/cdl/en/ormpex/67518/HTML/default/viewer.htm#titlepage.htm"&gt;SAS/OR(R) 13.2 User's Guide: Mathematical Programming Examples&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Jun 2015 19:35:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/For-loop-in-PROC-OPTMODEL/m-p/197391#M999</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2015-06-01T19:35:12Z</dc:date>
    </item>
  </channel>
</rss>

