<?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: Copying values  to an array in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/Copying-values-to-an-array/m-p/354921#M1802</link>
    <description>&lt;P&gt;Thanks Rob,&amp;nbsp;&lt;/P&gt;&lt;P&gt;what I am trying to achieve is to take the optimized quantity&amp;nbsp; "Quantity", offset it x places, and give this output (Quantity) as an input to Quantity2, where I will run another optimization model on it Quantity2.&amp;nbsp;&amp;nbsp;" I assume I can have both in the same program?"&lt;/P&gt;&lt;P&gt;So Quantity is not actually a number it's a variable and I receive the following&amp;nbsp;error when saying that &amp;nbsp;&lt;/P&gt;&lt;P&gt;Quantity2{i in Item} = Quantity[mod(i+2,8)];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;as Quantity is a var &amp;nbsp;and Quantity2 is number&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;537-782 the value of parameter "Quantity2" depends on a variable&lt;/P&gt;</description>
    <pubDate>Mon, 01 May 2017 13:51:50 GMT</pubDate>
    <dc:creator>AAZ</dc:creator>
    <dc:date>2017-05-01T13:51:50Z</dc:date>
    <item>
      <title>Copying values  to an array</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Copying-values-to-an-array/m-p/354751#M1798</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have an array of values &amp;nbsp;&lt;/P&gt;&lt;P&gt;"number Quantity{Item}=[0 0&amp;nbsp;30 40 50 0 60 70]" and want to assign these values to another array Quantity2 and change the index to -2 &amp;nbsp;so &amp;nbsp;it should equal [30 40 50 0 60 70 0 0]. How to achive that with optmodel.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 29 Apr 2017 23:14:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Copying-values-to-an-array/m-p/354751#M1798</guid>
      <dc:creator>AAZ</dc:creator>
      <dc:date>2017-04-29T23:14:48Z</dc:date>
    </item>
    <item>
      <title>Re: Copying values  to an array</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Copying-values-to-an-array/m-p/354837#M1799</link>
      <description>&lt;P&gt;Here's one way:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc optmodel;
   set Item = 0..7;
   number Quantity{Item}=[0 0 30 40 50 0 60 70];
   number Quantity2{i in Item} = Quantity[mod(i+2,8)];
   print Quantity Quantity2;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;SAS Output&lt;/P&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table" summary="Procedure Optmodel: PrintTable" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="l b header" scope="col"&gt;[1]&lt;/TH&gt;
&lt;TH class="r b header" scope="col"&gt;Quantity&lt;/TH&gt;
&lt;TH class="r b header" scope="col"&gt;Quantity2&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;0&lt;/TH&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;TD class="r data"&gt;30&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;1&lt;/TH&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;TD class="r data"&gt;40&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;2&lt;/TH&gt;
&lt;TD class="r data"&gt;30&lt;/TD&gt;
&lt;TD class="r data"&gt;50&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;3&lt;/TH&gt;
&lt;TD class="r data"&gt;40&lt;/TD&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;4&lt;/TH&gt;
&lt;TD class="r data"&gt;50&lt;/TD&gt;
&lt;TD class="r data"&gt;60&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;5&lt;/TH&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;TD class="r data"&gt;70&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;6&lt;/TH&gt;
&lt;TD class="r data"&gt;60&lt;/TD&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="l rowheader" scope="row"&gt;7&lt;/TH&gt;
&lt;TD class="r data"&gt;70&lt;/TD&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 30 Apr 2017 21:58:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Copying-values-to-an-array/m-p/354837#M1799</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2017-04-30T21:58:11Z</dc:date>
    </item>
    <item>
      <title>Re: Copying values  to an array</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Copying-values-to-an-array/m-p/354921#M1802</link>
      <description>&lt;P&gt;Thanks Rob,&amp;nbsp;&lt;/P&gt;&lt;P&gt;what I am trying to achieve is to take the optimized quantity&amp;nbsp; "Quantity", offset it x places, and give this output (Quantity) as an input to Quantity2, where I will run another optimization model on it Quantity2.&amp;nbsp;&amp;nbsp;" I assume I can have both in the same program?"&lt;/P&gt;&lt;P&gt;So Quantity is not actually a number it's a variable and I receive the following&amp;nbsp;error when saying that &amp;nbsp;&lt;/P&gt;&lt;P&gt;Quantity2{i in Item} = Quantity[mod(i+2,8)];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;as Quantity is a var &amp;nbsp;and Quantity2 is number&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;537-782 the value of parameter "Quantity2" depends on a variable&lt;/P&gt;</description>
      <pubDate>Mon, 01 May 2017 13:51:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Copying-values-to-an-array/m-p/354921#M1802</guid>
      <dc:creator>AAZ</dc:creator>
      <dc:date>2017-05-01T13:51:50Z</dc:date>
    </item>
    <item>
      <title>Re: Copying values  to an array</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Copying-values-to-an-array/m-p/354928#M1803</link>
      <description>&lt;P&gt;If Quantity is a variable, then it sounds like you want to declare Quantity2 as an implicit variable (by using the &lt;A href="http://go.documentation.sas.com/?docsetId=ormpug&amp;amp;docsetVersion=14.2&amp;amp;docsetTarget=ormpug_optmodel_syntax03.htm&amp;amp;locale=en#ormpug.optmodel.npximpvarstmt" target="_self"&gt;IMPVAR statement&lt;/A&gt;).&lt;/P&gt;</description>
      <pubDate>Mon, 01 May 2017 14:11:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Copying-values-to-an-array/m-p/354928#M1803</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2017-05-01T14:11:09Z</dc:date>
    </item>
  </channel>
</rss>

