## PROC OPTMODEL Var statement index specification

Solved
Super Contributor
Posts: 455

# PROC OPTMODEL Var statement index specification

Hi,

I am working on SAS mathematical programming examples (more precisely ch 7 in https://support.sas.com/documentation/cdl/en/ormpex/64980/PDF/default/ormpex.pdf) with PROC OPTMODEL.

Here is a part of the VAR statements:

var IsOpen {MINES, YEARS} binary;
var IsWorked {MINES, YEARS} binary;
var Extract {mine in MINES, YEARS} >= 0 <= extract_ub[mine];

My question is why for the VAR EXTRACT are added the words "mine in", unlike the VARS above it, and how could I know whether I should add such specifications.

Thank you!

Accepted Solutions
Solution
‎11-27-2016 10:17 PM
SAS Employee
Posts: 538

## Re: PROC OPTMODEL Var statement index specification

The dummy indices are optional in the first two VAR statements.  For example, if you prefer you could write the first one as follows:

``var IsOpen {mine in MINES, year in YEARS} binary;``

The dummy index is required for the third VAR statement because the upper bound extract_ub[mine] depends on it.

All Replies
Solution
‎11-27-2016 10:17 PM
SAS Employee
Posts: 538

## Re: PROC OPTMODEL Var statement index specification

The dummy indices are optional in the first two VAR statements.  For example, if you prefer you could write the first one as follows:

``var IsOpen {mine in MINES, year in YEARS} binary;``

The dummy index is required for the third VAR statement because the upper bound extract_ub[mine] depends on it.

Super Contributor
Posts: 455

## Re: PROC OPTMODEL Var statement index specification

So if I understand correctly, on p.83:

num discount {year in YEARS} = 1 / (1 + &discount_rate)^(year - 1);

here we have "year" in YEARS becasue there is also "year" on the RHS, whereas for:

proc optmodel;
set <str> MINES;
num cost {MINES};
num extract_ub {MINES};
num quality {MINES};
read data mine_data into MINES=[mine] cost extract_ub quality;

here for the num cost, extract_ub and quality there is no "mine" in MINES becasue there is no RHS part of an equation where "mine" is specified, but here the values are just being read.

SAS Employee
Posts: 538

## Re: PROC OPTMODEL Var statement index specification

Yes, that is correct.

☑ This topic is solved.