<?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: Reading an Array in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/Reading-an-Array/m-p/723011#M3338</link>
    <description>&lt;P&gt;The simplest change is:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;num Containers {Ports,DC} init 0;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But the more efficient approach, to create a sparse index set of tuples, is what Natalia is suggesting:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;set &amp;lt;str,str&amp;gt; Ports_DC;
num Containers {Ports_DC};
read data STDOPT.PN3381_data into Ports_DC=[PortSource RateMatchDest] Containers=FEU;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then use Ports_DC in the rest of your code when you need to reference Containers.&lt;/P&gt;</description>
    <pubDate>Tue, 02 Mar 2021 22:47:02 GMT</pubDate>
    <dc:creator>RobPratt</dc:creator>
    <dc:date>2021-03-02T22:47:02Z</dc:date>
    <item>
      <title>Reading an Array</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Reading-an-Array/m-p/722972#M3334</link>
      <description>&lt;P&gt;Hi I have an error that I am trying to fix.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;proc optmodel;
set &amp;lt;str&amp;gt; Ports;
set &amp;lt;str&amp;gt; DC;
read data STDOPT.PN3381_Ports into Ports=[PortSource];
read data STDOPT.PN3381_DC into DC=[RateMatchDest];
num Containers {Ports,DC};
read data STDOPT.PN3381_data into [PortSource RateMatchDest] Containers=FEU;&lt;/PRE&gt;&lt;P&gt;Here is an instance of my error. But there are many more instances like this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;SPAN&gt;The array element 'Containers[HPH,ADM]' has no value at line 125 column 71.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In my data, I know for a fact that there is no HPH,ADM. So, that combo HPH-ADM can be 0. But is SAS expect a value there of 0?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Mar 2021 20:35:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Reading-an-Array/m-p/722972#M3334</guid>
      <dc:creator>Santha</dc:creator>
      <dc:date>2021-03-02T20:35:25Z</dc:date>
    </item>
    <item>
      <title>Re: Reading an Array</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Reading-an-Array/m-p/722988#M3335</link>
      <description>Without looking at the data I would guess it is because not all combinations of Ports and DCs exist in PN_3381_data. &lt;BR /&gt;&lt;BR /&gt;I would suggest to read into a tuple set instead of individual PORTS and DCs, unless you need those even if they have no entry in PN_3381_data.&lt;BR /&gt;&lt;BR /&gt;Do you need a sample syntax for the tuple set?&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Natalia</description>
      <pubDate>Tue, 02 Mar 2021 21:30:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Reading-an-Array/m-p/722988#M3335</guid>
      <dc:creator>PinkOptimizer</dc:creator>
      <dc:date>2021-03-02T21:30:28Z</dc:date>
    </item>
    <item>
      <title>Re: Reading an Array</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Reading-an-Array/m-p/722990#M3336</link>
      <description>&lt;P&gt;Hi Natalia&lt;/P&gt;&lt;P&gt;Yes you are right that&amp;nbsp;&lt;SPAN&gt;it is because not all combinations of Ports and DCs exist in PN_3381_data.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;And so i&amp;nbsp;&lt;/P&gt;&lt;P&gt;PortSource = "BOM'&lt;/P&gt;&lt;P&gt;RateMatchDest='ADM'&amp;nbsp;&lt;/P&gt;&lt;P&gt;FEU=100&lt;/P&gt;&lt;P&gt;so [BOM,ADU]=100 is a sample but [BOM,ADM] is not there in the data set. If it is not there in the data, its okay to ignore that combination which does not exist in the data in the first place. Does this answer ur question?&lt;/P&gt;</description>
      <pubDate>Tue, 02 Mar 2021 21:40:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Reading-an-Array/m-p/722990#M3336</guid>
      <dc:creator>Santha</dc:creator>
      <dc:date>2021-03-02T21:40:34Z</dc:date>
    </item>
    <item>
      <title>Re: Reading an Array</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Reading-an-Array/m-p/723010#M3337</link>
      <description>&lt;P&gt;Hi Natalia&lt;/P&gt;&lt;P&gt;Based on your response, I was able to artificially have 0 values in the data to avoid this problem.&amp;nbsp; However, I am not sure if this is a good approach. I am thinking probably not. If there is a way where we can tell ignore missing values in error that would be better.&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Mar 2021 22:35:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Reading-an-Array/m-p/723010#M3337</guid>
      <dc:creator>Santha</dc:creator>
      <dc:date>2021-03-02T22:35:58Z</dc:date>
    </item>
    <item>
      <title>Re: Reading an Array</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Reading-an-Array/m-p/723011#M3338</link>
      <description>&lt;P&gt;The simplest change is:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;num Containers {Ports,DC} init 0;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But the more efficient approach, to create a sparse index set of tuples, is what Natalia is suggesting:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;set &amp;lt;str,str&amp;gt; Ports_DC;
num Containers {Ports_DC};
read data STDOPT.PN3381_data into Ports_DC=[PortSource RateMatchDest] Containers=FEU;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then use Ports_DC in the rest of your code when you need to reference Containers.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Mar 2021 22:47:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Reading-an-Array/m-p/723011#M3338</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2021-03-02T22:47:02Z</dc:date>
    </item>
    <item>
      <title>Re: Reading an Array</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Reading-an-Array/m-p/723039#M3339</link>
      <description>&lt;P&gt;THanks Rob and Natalia for your inputs . you guys are awesome&lt;/P&gt;</description>
      <pubDate>Wed, 03 Mar 2021 00:09:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Reading-an-Array/m-p/723039#M3339</guid>
      <dc:creator>Santha</dc:creator>
      <dc:date>2021-03-03T00:09:14Z</dc:date>
    </item>
    <item>
      <title>Re: Reading an Array</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Reading-an-Array/m-p/723050#M3342</link>
      <description>&lt;P&gt;Glad to help.&amp;nbsp; You might also review this documentation example:&amp;nbsp;&lt;A href="https://go.documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=v_009&amp;amp;docsetId=casmopt&amp;amp;docsetTarget=casmopt_optmodel_examples07.htm&amp;amp;locale=en"&gt;SAS Help Center: Sparse Modeling&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Mar 2021 00:29:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Reading-an-Array/m-p/723050#M3342</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2021-03-03T00:29:41Z</dc:date>
    </item>
  </channel>
</rss>

