Chapter Contents Previous Next
 The ASSIGN Procedure

Example 2.1: Assigning Subcontractors to Construction Jobs

This example shows how PROC ASSIGN can be used to maximize an objective function. Consider a construction project that consists of nine jobs. Because of the nature of the project, each job must be performed by a different subcontractor. Each job is bid upon by twelve subcontractors. The matrix that follows shows the expected profit to the contractor if each job is given to each subcontractor. Each row in the matrix represents a different job, and each column represents a different subcontractor.

```SUBCONTRACTOR 1  2  3  4  5  6  7  8  9 10 11 12
________________________________________________
JOB1   |  79 24 13 53 47 66 85 17 92 47 46 13
JOB2   |  43 59 33 95 55 97 34 55 84 94 26 56
JOB3   |  29 52  0 27 13 33  0 11 71 86  6 76
JOB4   |  88 83 64 72  0 67 27 47 83 62 35 38
JOB5   |  65 90 56 62 53 91 48 23  6 89 49 33
JOB6   |  44 79 86 93 71  7 86 59  0 56 45 59
JOB7   |  35 51 -9 91 39 32  3 12 79 25 79 81
JOB8   |  50 12 59 32 23 64 20 94 97 14 11 97
JOB9   |  25 17 39  . 38 63 87 14  4 18 11 45
```

The negative profit in the third column means that if job 7 is awarded to subcontractor 3, the contractor loses money. The missing value in the fourth column means that subcontractor 4 did not bid on job 9. PROC ASSIGN treats a missing value differently from the way it treats a 0. While it is possible that an optimal assignment could include a 0 (or even a negative) contribution to profit, the missing value is never included in an assignment. In this case, subcontractor 4 is never awarded job 9, regardless of the profit structure.

You can use PROC ASSIGN to find how the contractor should award the jobs to the subcontractors to maximize his profit. First, put the data in a SAS data set. Then, call PROC ASSIGN using the MAXIMUM option. The following statements produce Output 2.1.1:

```   title 'Assigning Subcontractors to Construction Jobs';

data profit;
input job \$ subcon1-subcon12;
datalines;
JOB1 79 24 13 53 47 66 85 17 92 47 46 13
JOB2 43 59 33 95 55 97 34 55 84 94 26 56
JOB3 29 52  0 27 13 33  0 11 71 86  6 76
JOB4 88 83 64 72  0 67 27 47 83 62 35 38
JOB5 65 90 56 62 53 91 48 23  6 89 49 33
JOB6 44 79 86 93 71  7 86 59  0 56 45 59
JOB7 35 51 -9 91 39 32  3 12 79 25 79 81
JOB8 50 12 59 32 23 64 20 94 97 14 11 97
JOB9 25 17 39  . 38 63 87 14  4 18 11 45
;
proc assign maximum data=profit;
cost subcon1-subcon12;
id job;
run;

proc print;
sum _fcost_;
run;
```

The cost of the optimal assignment written to the SAS log is

```NOTE: The maximum return assignment yields 814.
```

This means that the contractor can expect a profit of \$814 if he follows the optimal assignment.

Output 2.1.1: Assigning Subcontractors to Construction Jobs

 Assigning Subcontractors to Construction Jobs

 Obs job subcon1 subcon2 subcon3 subcon4 subcon5 subcon6 subcon7 subcon8 subcon9 subcon10 subcon11 subcon12 _ASSIGN_ _FCOST_ 1 JOB1 79 24 13 53 47 66 85 17 92 47 46 13 subcon9 92 2 JOB2 43 59 33 95 55 97 34 55 84 94 26 56 subcon6 97 3 JOB3 29 52 0 27 13 33 0 11 71 86 6 76 subcon10 86 4 JOB4 88 83 64 72 0 67 27 47 83 62 35 38 subcon1 88 5 JOB5 65 90 56 62 53 91 48 23 6 89 49 33 subcon2 90 6 JOB6 44 79 86 93 71 7 86 59 0 56 45 59 subcon3 86 7 JOB7 35 51 -9 91 39 32 3 12 79 25 79 81 subcon4 91 8 JOB8 50 12 59 32 23 64 20 94 97 14 11 97 subcon12 97 9 JOB9 25 17 39 . 38 63 87 14 4 18 11 45 subcon7 87 814

Note that three subcontractors, SUBCON5, SUBCON8, and SUBCON11, are not assigned to any jobs.

 Chapter Contents Previous Next Top