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

Creating a set from a data set within optmodel

Accepted Solution Solved
Reply
Highlighted
New Contributor
Posts: 2
Accepted Solution

Creating a set from a data set within optmodel

Hey! (working on SAS Studio)

 

I am trying to create a set in the proc optmodel body of my program, but so far I haven't been successful.

For small sets is ok to create the sets for variables, parameters in the declaration statement but right now I am working with a problem instance that has 200+ elements in one set and 1300+ in another one, so I wonder if there is a way to create a set from a previous data set I can create beforehand.

 

Something like this.

 

Data H;
input ids;
datalines;
131
199
229
512
;
Run;

proc optmodel;
set Hubs;
Read data H into Hubs=ids;

 


Accepted Solutions
Solution
‎03-07-2018 01:57 PM
SAS Employee
Posts: 575

Re: Creating a set from a data set within optmodel

You almost had it.  You just need square brackets around the key column(s):

Read data H into Hubs=[ids];

You might find this book of examples useful for learning about PROC OPTMODEL.

View solution in original post


All Replies
Solution
‎03-07-2018 01:57 PM
SAS Employee
Posts: 575

Re: Creating a set from a data set within optmodel

You almost had it.  You just need square brackets around the key column(s):

Read data H into Hubs=[ids];

You might find this book of examples useful for learning about PROC OPTMODEL.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

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