Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
The ASSIGN Procedure

Example 2.2: Assigning Construction Jobs to Subcontractors

Suppose that the data from Example 2.1 are transposed so that variables are jobs. Then each observation contains the profit from awarding each job to a single subcontractor. The following program finds the maximum profit assignment and produces Output 2.2.1:

   title 'Assigning Construction Jobs to Subcontractors';

   data profit;
      input subcont $ job1-job9;
      cards;
SUBCON1   79   43   29   88   65   44   35   50   25
SUBCON2   24   59   52   83   90   79   51   12   17
SUBCON3   13   33    0   64   56   86   -9   59   39
SUBCON4   53   95   27   72   62   93   91   32    .
SUBCON5   47   55   13    0   53   71   39   23   38
SUBCON6   66   97   33   67   91    7   32   64   63
SUBCON7   85   34    0   27   48   86   32    0   87
SUBCON8   17   55   11   47   23   59   12   94   14
SUBCON9   92   84   71   83    6    0   79   97    4
SUBCON10  47   94   86   62   89   56   25   14   18
SUBCON11  46   26    6   35   49   45   79   11   11
SUBCON12  13   56   76   38   33   59   81   97   45
   ;

   proc assign maximum data=profit;
      cost job1-job9;
      id subcont;
   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 the optimal assignment is followed.

Output 2.2.1: Assigning Subcontractors to Construction Jobs

Assigning Construction Jobs to Subcontractors

Obs subcont job1 job2 job3 job4 job5 job6 job7 job8 job9 _ASSIGN_ _FCOST_
1 SUBCON1 79 43 29 88 65 44 35 50 25 job4 88
2 SUBCON2 24 59 52 83 90 79 51 12 17 job5 90
3 SUBCON3 13 33 0 64 56 86 -9 59 39 job6 86
4 SUBCON4 53 95 27 72 62 93 91 32 . job7 91
5 SUBCON5 47 55 13 0 53 71 39 23 38   0
6 SUBCON6 66 97 33 67 91 7 32 64 63 job2 97
7 SUBCON7 85 34 0 27 48 86 32 0 87 job9 87
8 SUBCON8 17 55 11 47 23 59 12 94 14   0
9 SUBCON9 92 84 71 83 6 0 79 97 4 job1 92
10 SUBCON10 47 94 86 62 89 56 25 14 18 job3 86
11 SUBCON11 46 26 6 35 49 45 79 11 11   0
12 SUBCON12 13 56 76 38 33 59 81 97 45 job8 97
                        814


The macro variable _ORASSIG defined by PROC ASSIGN contains information regarding the termination of the procedure.

This information can be useful when you use PROC ASSIGN as part of a larger SAS program. For example, the following information is written to on the log using the macro language with the statement:

   %put  &_orassig;

On the log the following appears

Output 2.2.2: _ORASSIG macro variable
   STATUS=SUCCESSFUL OBJECTIVE=814.

Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Top
Top

Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.