<?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: How to Correctly Structure and Read a SAS data set into OPTMODEL in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/How-to-Correctly-Structure-and-Read-a-SAS-data-set-into-OPTMODEL/m-p/262600#M1295</link>
    <description>&lt;P&gt;Attached is the program. The code above didn't come out as intented.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 08 Apr 2016 21:27:30 GMT</pubDate>
    <dc:creator>jhlaramore</dc:creator>
    <dc:date>2016-04-08T21:27:30Z</dc:date>
    <item>
      <title>How to Correctly Structure and Read a SAS data set into OPTMODEL</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/How-to-Correctly-Structure-and-Read-a-SAS-data-set-into-OPTMODEL/m-p/262598#M1294</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to understand&amp;nbsp;how to correctly structure the data in a SAS data set (or in an Excel file that can be converted into a SAS data set&amp;nbsp;via PROC IMPORT) so the index sets and known parameters in the SET and NUM statements don't need to be hard coded within the OPTMODEL procedure.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My end goal is to create a generalizable optimization program that can accomodate any number of values based on a&amp;nbsp;predefined SAS data set that can be read into OPTMODEL, so that if editing is required, all editing is done outside of the OPTMODEL procedure.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below is&amp;nbsp;a sample program. It executes and runs without error as is, but&amp;nbsp;am having trouble with the issue mentioned above.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you in advance for any help you can provide.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc optmodel;&lt;BR /&gt;&lt;BR /&gt;set DAYS=1..3;&lt;BR /&gt;set LAWNS=/Lawn1 Lawn2 Lawn3 Lawn4/;&lt;BR /&gt;&lt;BR /&gt;num RevenueSchedule{DAYS,LAWNS}=[60 35 0 0 0 35 25 20 0 35 25 20]; &lt;BR /&gt;num TimeAvailable{DAYS}=[8 6 6];&lt;BR /&gt;num TimePerLawn{LAWNS}=[6 4 3 3];&lt;BR /&gt;&lt;BR /&gt;var Do{DAYS,LAWNS} &amp;gt;=0 binary;&lt;BR /&gt;&lt;BR /&gt;impvar TimeSpentMowing{d in DAYS}= sum{l in LAWNS} Do[d,l]*TimePerLawn[l];&lt;BR /&gt;&lt;BR /&gt;impvar TimeLeftOver{d in DAYS}= TimeAvailable[d] - TimeSpentMowing[d];&lt;BR /&gt;&lt;BR /&gt;max TotalRevenue=sum{d in DAYS,l in LAWNS} Do[d,l]*RevenueSchedule[d,l];&lt;BR /&gt;&lt;BR /&gt;con TimePerDay{d in DAYS}: TimeSpentMowing[d] &amp;lt;= TimeAvailable[d];&lt;BR /&gt;&lt;BR /&gt;con NotMoreThanOnce{l in LAWNS}: sum{d in DAYS} Do[d,l]&amp;lt;=1;&lt;BR /&gt;&lt;BR /&gt;solve;&lt;BR /&gt;&lt;BR /&gt;print RevenueSchedule TimePerLawn;&lt;BR /&gt;print Do TimeAvailable TimeSpentMowing TimeLeftOver;&lt;BR /&gt;&lt;BR /&gt;quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 21:23:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/How-to-Correctly-Structure-and-Read-a-SAS-data-set-into-OPTMODEL/m-p/262598#M1294</guid>
      <dc:creator>jhlaramore</dc:creator>
      <dc:date>2016-04-08T21:23:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to Correctly Structure and Read a SAS data set into OPTMODEL</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/How-to-Correctly-Structure-and-Read-a-SAS-data-set-into-OPTMODEL/m-p/262600#M1295</link>
      <description>&lt;P&gt;Attached is the program. The code above didn't come out as intented.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 21:27:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/How-to-Correctly-Structure-and-Read-a-SAS-data-set-into-OPTMODEL/m-p/262600#M1295</guid>
      <dc:creator>jhlaramore</dc:creator>
      <dc:date>2016-04-08T21:27:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to Correctly Structure and Read a SAS data set into OPTMODEL</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/How-to-Correctly-Structure-and-Read-a-SAS-data-set-into-OPTMODEL/m-p/262601#M1296</link>
      <description>&lt;P&gt;Here's one way, using three data sets:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data day_data;
   input day TimeAvailable;
   datalines;
1 8
2 6
3 6
;

data lawn_data;
   input lawn $ TimePerLawn;
   datalines;
Lawn1 6
Lawn2 4
Lawn3 3
Lawn4 3
;

data day_lawn_data;
   input day lawn1-lawn4;
   datalines;
1 60 35  0  0
2  0 35 25 20
3  0 35 25 20
;

proc optmodel;
   set DAYS;
   num TimeAvailable{DAYS};
   read data day_data into DAYS=[day] TimeAvailable;
   set &amp;lt;str&amp;gt; LAWNS;
   num TimePerLawn{LAWNS};
   read data lawn_data into LAWNS=[lawn] TimePerLawn;
   num RevenueSchedule{DAYS,LAWNS};
   read data day_lawn_data into [day] {j in LAWNS} &amp;lt;RevenueSchedule[day,j]=col(j)&amp;gt;;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You might also find this book of examples useful:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/ormpex/68157/HTML/default/viewer.htm#titlepage.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/ormpex/68157/HTML/default/viewer.htm#titlepage.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 21:38:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/How-to-Correctly-Structure-and-Read-a-SAS-data-set-into-OPTMODEL/m-p/262601#M1296</guid>
      <dc:creator>RobPratt</dc:creator>
      <dc:date>2016-04-08T21:38:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to Correctly Structure and Read a SAS data set into OPTMODEL</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/How-to-Correctly-Structure-and-Read-a-SAS-data-set-into-OPTMODEL/m-p/262604#M1297</link>
      <description>&lt;P&gt;Thank you, Rob!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 21:49:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/How-to-Correctly-Structure-and-Read-a-SAS-data-set-into-OPTMODEL/m-p/262604#M1297</guid>
      <dc:creator>jhlaramore</dc:creator>
      <dc:date>2016-04-08T21:49:04Z</dc:date>
    </item>
  </channel>
</rss>

