BookmarkSubscribeRSS Feed
JeffGT
Calcite | Level 5
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!!!

JeffGT
1 REPLY 1
Philipp_SAS
SAS Employee
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.
Philipp

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 1018 views
  • 0 likes
  • 2 in conversation