The GANTT Procedure |
This example shows how to use the GANTT procedure to obtain a basic line-printer Gantt chart using the default options. The following data describe the precedence relationships among the tasks involved in the construction of a typical floor in a multistory building. The first step saves the precedence relationships in a SAS data set. The variable ACTIVITY names each task, the variable DUR specifies the time it takes to complete the task in days, and the variables SUCCESS1 to SUCCESS4 specify tasks that are immediate successors to the task identified by the ACTIVITY variable.
PROC CPM determines the shortest schedule for the project that finishes before September 1, 2004. The solution schedule, saved in a SAS data set, is next sorted by the early start time before invoking the GANTT procedure to plot the schedule. Since the DATA= option is not specified, PROC GANTT uses the sorted data set to produce the schedule since it is the most recently created data set. The Gantt chart in Output 6.1.1 is plotted on two pages because there are too many observations (29) to fit on one page. Note that the observations are split into two groups containing 15 and 14 observations, respectively, so that the chart size on each page is approximately equal. The time axis is labeled from June 21, 2004, to September 1, 2004, since these are the minimum and maximum dates in the Schedule data set. A legend is displayed at the bottom of the chart on each page.
title 'Gantt Example 1'; title2 'Printing a Gantt Chart'; data; format activity $20. success1 $20. success2 $20. success3 $20. success4 $20.; input activity dur success1-success4; datalines; form 4 pour . . . pour 2 core . . . core 14 strip spray_fireproof insulate_walls . strip 2 plumbing curtain_wall risers doors strip 2 electrical_walls balance_elevator . . curtain_wall 5 glaze_sash . . . glaze_sash 5 spray_fireproof insulate_walls . . spray_fireproof 5 ceil_ducts_fixture . . . ceil_ducts_fixture 5 test . . . plumbing 10 test . . . test 3 insulate_mechanical . . . insulate_mechanical 3 lath . . . insulate_walls 5 lath . . . risers 10 ceil_ducts_fixture . . . doors 1 port_masonry . . . port_masonry 2 lath finish_masonry . . electrical_walls 16 lath . . . balance_elevator 3 finish_masonry . . . finish_masonry 3 plaster marble_work . . lath 3 plaster marble_work . . plaster 5 floor_finish tiling acoustic_tiles . marble_work 3 acoustic_tiles . . . acoustic_tiles 5 paint finish_mechanical . . tiling 3 paint finish_mechanical . . floor_finish 5 paint finish_mechanical . . paint 5 finish_paint . . . finish_mechanical 5 finish_paint . . . finish_paint 2 caulking_cleanup . . . caulking_cleanup 4 finished . . . ; * invoke cpm to find the optimal schedule; proc cpm finishbefore date='1sep04'd; activity activity; duration dur; successors success1-success4; run; * sort the schedule by the early start date; proc sort; by e_start; run; * invoke proc gantt to print the schedule; proc gantt lineprinter; run;Output 6.1.1: Printing a Gantt Chart
Copyright © 2008 by SAS Institute Inc., Cary, NC, USA. All rights reserved.