BookmarkSubscribeRSS Feed
cr4
Calcite | Level 5 cr4
Calcite | Level 5
Hi, I am still fairly new to SAS and can do most of your basic tests and codes. I am an intern at a company and am working on a school project that involves the company, and am having trouble with PROC OPTMODEL. Thought I could teach myself, but it’s a bit harder than I realized. I am attaching a very short modified dataset as an example of what I am trying to do with a larger dataset. I’d like to start small, and learn how to add more constraints to my larger model myself. But I can’t even get a basic code to run. I’m trying to optimize a schedule for efficiency. (Later, I’d use cost, etc). I have three people in the data set that need to work 3 days, 8 hour shifts, when available (1). I am attaching what I have so far. Any help or sample code so I could get a base start would be very much appreciated! Thank you!
1 REPLY 1
RobPratt
SAS Super FREQ

The simplest way to get your code working is to make the following changes.

 

1. Change the declaration of two sets:

    set <str> GUARDS;
    set <str> SHIFTS;

2. Replace the READ DATA statement:

    read data guard_availability into GUARDS=[Guard];
    read data guard_availability into SHIFTS=[Shift];
    read data guard_availability into DATES=[Date];
    read data guard_availability into [Guard Shift Date]
        Available Hours;

3. Change the CREATE DATA statement:

    create data schedule from [Guard Shift Date] Assigned=x;

You might find this book of examples useful:

SAS Help Center: SAS/OR® User's Guide: Mathematical Programming Examples

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!

Register now

Discussion stats
  • 1 reply
  • 1399 views
  • 3 likes
  • 2 in conversation