The GANTT Procedure |
Suppose that the project is complete and you want to compare the actual progress of the activities with the predicted schedule computed by PROC CPM. The following DATA step stores the actual start and finish times of each activity in a data set named COMPLETE. A data set named WIDGELA is then created that contains both the schedule obtained from PROC CPM (the data set SAVEH from Example 6.3 is used because it does not contain the dummy activity) and the actual schedule. The resulting data set is sorted by early start time.
Fill patterns are specified using PATTERN statements, and the COMPRESS option is employed in order to draw the entire Gantt chart on one page. Predicted schedules as well as actual schedules are plotted on separate bars for each activity. The A_START= and A_FINISH= options in the CHART statement are used to specify the variables containing the actual start and finish times for each activity. The actual schedule is plotted with the fill pattern specified in the sixth PATTERN statement. This example also illustrates the drawing of holidays in graphics mode. PROC GANTT uses the fill pattern specified in the seventh PATTERN statement to represent the holidays defined by the HOLIDATA= data set. The holidays are identified to PROC GANTT by specifying the HOLIDAY= and HOLIFIN= options in the CHART statement.
The HCONNECT option causes a connecting line to be drawn from the left boundary of the chart to the early start time for each activity. The CHCON= option specifies the color for drawing the connect lines. You can use the LHCON= option in the CHART statement to specify a line style other than the default style for the connect lines. The Gantt chart is shown in Output 6.10.1.
data complete; format activity $12. sdate date7. fdate date7.; input activity & sdate & date7. fdate & date7.; datalines; Approve Plan 01dec03 05dec03 Drawings 06dec03 16dec03 Study Market 05dec03 09dec03 Write Specs 07dec03 12dec03 Prototype 17dec03 03jan04 Mkt. Strat. 10dec03 19dec03 Materials 02jan04 11jan04 Facility 01jan04 13jan04 Init. Prod. 13jan04 21jan04 Evaluate 22jan04 01feb04 Test Market 23jan04 08feb04 Changes 05feb04 11feb04 Production 12feb04 12feb04 Marketing 26jan04 26jan04 ; * merge the computed schedule with the actual schedule; data widgela; merge saveh complete; run; * sort the data; proc sort; by e_start; run; title f='Albany AMT' 'Gantt Example 10'; title2 f='Albany AMT' 'Plotting Actual Start and Finish Times on the Chart'; * set vpos to 40 and hpos to 100; goptions vpos=40 hpos=100;
* set up required pattern statements; pattern1 c=green v=s; /* duration of a noncrit. activity */ pattern2 c=green v=e; /* slack time for a noncrit. act. */ pattern3 c=red v=s; /* duration of a critical activity */ pattern4 c=green v=s; /* slack time for a supercrit. act. */ pattern5 c=green v=e; /* duration of a supercrit. act. */ pattern6 c=cyan v=s; /* actual duration of an activity */ pattern7 c=black v=x1; /* break due to a holiday */
* plot the computed and actual schedules using proc gantt; proc gantt data=widgela holidata=holidays; chart / holiday=(holiday) holifin=(holifin) height=1.5 a_start=sdate a_finish=fdate dur=days cmile=blue font='Albany AMT' ctext=blue caxis=black hconnect compress; id task; run;Output 6.10.1: Plotting the Actual Schedule on the Gantt Chart
Copyright © 2008 by SAS Institute Inc., Cary, NC, USA. All rights reserved.