The Microsoft Project Conversion Macros


Example 6.8 Exporting Resource-Constrained Schedules

In this example, a project is scheduled subject to resource constraints.

Before you continue, make sure that in your Microsoft Project software, "resource leveling" is properly set as follows so that the resource-constrained schedule is automatically displayed in the Gantt chart. From the Microsoft Project Tools menu, select Level Resources (Resource Leveling in Microsoft Project 2000). Then select Automatic for Leveling calculations. Clear Level only within available slack for Resolving overallocations. Then click on OK.

The following DATA steps specify the project in this example. Resource assignments are specified in the data set Activity, and the resource availabilities are defined in the data set Resources.

data activity;
   format task succ1 $8.;
   input task dur succ1 engineer writer tester;
   datalines;
Design    5  Develop   1  .  1
Develop  10  Document  1  .  1
Develop  10  Test      1  .  1
Document  6  Ship      1  1  .
Test      8  Ship      1  .  1
Ship      0  .         .  .  .
;
data resources;
   format obstype $8.;
   input obstype date: date7. engineer writer tester;
   datalines;
reslevel  15Dec06  .  .  1
reslevel  18Dec06  1  .  .
reslevel  30Dec06  .  1  .
;

The PM invocation is given in the following statements. The resource data set is specified with resin=resources; and the RESOURCE statement is also added to identify the applicable resources.

proc pm data=activity
   date='15Dec06'd      
   resin=resources;
   act task;
   succ succ1;
   duration dur;
   resource engineer writer tester / period=date;  
run;

The resulting PM window is shown in Output 6.8.1. Notice that both the early schedule and the resource-constrained schedule are displayed in the Gantt chart.

Output 6.8.1: PM Window

PM Window


To convert the data to an MDB file that includes resource requirements, you use the following call to %SASTOMSP:

%sastomsp(mdbfile=mspref,
          resds=resources,
          _activity=task,
          _date='15Dec06'd,
          _resobstype=obstype,
          _resource=engineer writer tester,
          _resperiod=date);

The resulting MS Project window is shown in Output 6.8.2.

Output 6.8.2: MS Project Window

MS Project Window


In Output 6.8.2, Microsoft Project displays only the resource-constrained schedule. To get a comparison view as in the PM procedure, you can save the output schedule of the PM procedure and specify the SCHEDULEDS= parameter in the call to %SASTOMSP, as follows:

proc pm data=activity
   date='15Dec06'd   
   resin=resources out=schedule;
   act task;
   succ succ1;
   duration dur;
   resource engineer writer tester / period=date;  
run;
filename mspref "C:\MSPROJ\sasmsp4b.mdb";
%sastomsp(mdbfile=mspref,
          resds=resources,
          scheduleds=schedule,
          _activity=task,
          _date='15Dec06'd,
          _resobstype=obstype,
          _resource=engineer writer tester,
          _resperiod=date);

The PROC PM window is identical to the one shown in Output 6.8.1, and the resulting Microsoft Project window is identical to the one shown in Output 6.8.2. However, the schedule information computed by SAS has been exported to the MDB file and is available for display in Microsoft Project.

You can manually set Microsoft Project to display the schedules in the Gantt Chart. In Microsoft Project, from the Format menu, select Bar Styles. Then change the Task number in the column Row from 1 to 2. Click on Insert Row. Type a name for the new row (e.g., SAS Early Schedule). Under From, select Start1 (SAS_E_start ). Under To, select Finish1 ( SAS_E_finish ). Click OK. The resulting window is shown in Output 6.8.3. Now both the resource-constrained schedule and the early schedule are displayed in the Gantt chart.

Output 6.8.3: MS Project Window

MS Project Window


You can also display the SAS_E_start and the SAS_E_finish in columns by going to the Insert menu, selecting Column, and selecting the Start1 (SAS_E_start ) and Finish1 (SAS_E_finish ) fields.