Operations Research topics: SAS/OR,
SAS Optimization, and SAS Simulation Studio

Help with Proc OptModel syntax

Posts: 1

Help with Proc OptModel syntax

Hi everyone.

Can someone tell me or direct me to where I can translate the following syntax from a SAS.Com example into English? I can't figure out what this does and cannot find the answer on the SAS website:

(from SAS ... optmodel_sect44.htm)

read data dmnd
into LOC=[loc]
{d in DOW} < demand[loc, d]=col("day"||d) >;

(from SAS ..... Example 8.3 Model Construction)
(especially line#4 ... I found the other lines by searching the SAS website for a few hours..... I estimate that line 4 will take me 2 days to figure out....)

/* load objective data */
read data object nomiss
into [machine customer]
{j in GRADES} ;

Thank you very very much in advance!!!

SAS Employee
Posts: 32

Re: Help with Proc OptModel syntax

Hello Jeff,

OPTMODEL and the especially the read statement are very powerful tools, unfortunately that goes hand in hand with being not so easy to understand.

First of all, OPTMODEL is an algebraic modeling language, so it creates a mathematical model of an optimization problem and then fill this model with data to create an optimization problem instance. That is a different approach from other SAS procs because modeling in OR is different from modeling in statistics.

I am not sure if all the code you wanted to paste into the forum showed up, the forum has a problem with the "less than or equal" character combination. But the two read statement that show up here (in their full length from the documentation) mean something like this:

1. read the data from the dataset dmnd, store the values of the data set column loc in the set LOC. Then for each of these values in LOC and for each element d in the set DOW, fill the parameter array demand with the according data from the data set.

2. Here machine and customer are variables in the data set that we use to when reading the data, we do not store it in a set as with did with loc in the previous example. It means something like: read machine and customer, then for each j in GRADES, store the data from the appropriate column in the parameter array return. Return is a three dimensional array, so it stores a value for each combination of machine, customer and j.

I hope this helps.
Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation