<?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 Read Data From 3D Array in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/Read-Data-From-3D-Array/m-p/726363#M3355</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;May I ask for your help with reading 3D array into the optmodel procedure?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have data with structure of different branches (rows) selling cars in different variants:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data selling;
	input branch $ Car01_variant01 Car01_variant02 Car01_variant03 Car02_variant01 Car02_variant02 Car02_variant03;
datalines;
AAA 100 101 102 210 220 230
BBB 104 105 106 240 250 260
CCC 107 108 109 270 280 290
;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Can I read this table to the optmodel to I can access it 3D array such as: selling[branch, car, variant]?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=ormpug&amp;amp;docsetTarget=ormpug_optmodel_examples03.htm&amp;amp;locale=en" target="_self"&gt;documentation&lt;/A&gt;, there is only examples of different "variants" having as another column with the a separate index, such as:&lt;/P&gt;&lt;PRE&gt;data selling;
	input branch $ variant Car01 Car01 Car01;
datalines;
AAA 1 100 101 102
BBB 1 104 105 106
CCC 1 107 108 109
AAA 2 ...
...
;&lt;/PRE&gt;&lt;P&gt;Do I need to transform the original table, or is there a way to read the complete 3D array in my structure?&lt;/P&gt;</description>
    <pubDate>Mon, 15 Mar 2021 13:49:08 GMT</pubDate>
    <dc:creator>asasgdsfa</dc:creator>
    <dc:date>2021-03-15T13:49:08Z</dc:date>
    <item>
      <title>Read Data From 3D Array</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Read-Data-From-3D-Array/m-p/726363#M3355</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;May I ask for your help with reading 3D array into the optmodel procedure?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have data with structure of different branches (rows) selling cars in different variants:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data selling;
	input branch $ Car01_variant01 Car01_variant02 Car01_variant03 Car02_variant01 Car02_variant02 Car02_variant03;
datalines;
AAA 100 101 102 210 220 230
BBB 104 105 106 240 250 260
CCC 107 108 109 270 280 290
;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Can I read this table to the optmodel to I can access it 3D array such as: selling[branch, car, variant]?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=ormpug&amp;amp;docsetTarget=ormpug_optmodel_examples03.htm&amp;amp;locale=en" target="_self"&gt;documentation&lt;/A&gt;, there is only examples of different "variants" having as another column with the a separate index, such as:&lt;/P&gt;&lt;PRE&gt;data selling;
	input branch $ variant Car01 Car01 Car01;
datalines;
AAA 1 100 101 102
BBB 1 104 105 106
CCC 1 107 108 109
AAA 2 ...
...
;&lt;/PRE&gt;&lt;P&gt;Do I need to transform the original table, or is there a way to read the complete 3D array in my structure?&lt;/P&gt;</description>
      <pubDate>Mon, 15 Mar 2021 13:49:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Read-Data-From-3D-Array/m-p/726363#M3355</guid>
      <dc:creator>asasgdsfa</dc:creator>
      <dc:date>2021-03-15T13:49:08Z</dc:date>
    </item>
    <item>
      <title>Re: Read Data From 3D Array</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Read-Data-From-3D-Array/m-p/726397#M3356</link>
      <description>&lt;P&gt;Here's one way:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc optmodel;
   set &amp;lt;str&amp;gt; BRANCHES;
   set CARS = /'01' '02'/;
   set VARIANTS = /'01' '02' '03'/;
   num selling {BRANCHES, CARS, VARIANTS};
   read data selling into BRANCHES=[branch] {c in CARS, v in VARIANTS} &amp;lt;selling[branch,c,v]=col('Car'||c||'_variant'||v)&amp;gt;;
   print selling;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Alternatively, you can read CARS and VARIANTS from other data sets rather than hard-coding their values in the SET statements.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Mar 2021 14:34:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Read-Data-From-3D-Array/m-p/726397#M3356</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2021-03-15T14:34:46Z</dc:date>
    </item>
    <item>
      <title>Re: Read Data From 3D Array</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Read-Data-From-3D-Array/m-p/726505#M3357</link>
      <description>Thank you a lot, it works (including the reading values to both sets).</description>
      <pubDate>Mon, 15 Mar 2021 18:53:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Read-Data-From-3D-Array/m-p/726505#M3357</guid>
      <dc:creator>asasgdsfa</dc:creator>
      <dc:date>2021-03-15T18:53:19Z</dc:date>
    </item>
  </channel>
</rss>

