Example 4.15: BY Processing
Every activity in the widget manufacturing project is carried out by
one of five departments: Planning, Engineering, Marketing, Manufacturing,
and Testing. The DETAILS data set in Example 4.6 identifies the
department responsible for each activity. Thus, the project can be
thought of as made up of five smaller subprojects, a subproject being the
work carried out by a department. A foreseeable need of the project manager
and every department is a separate Gantt chart for each subproject.
This example uses the WIDGETN data set from Example 2.1, which is
formed by merging the WIDGET data set with
the DETAILS data set. After scheduling the master project using PROC
CPM with DEPT as an ID variable, the Schedule data set is sorted by
department name and early start time. The GANTT procedure is then invoked
with the variable DEPT specified in the BY statement to obtain individual
Gantt charts for each subproject. The Gantt charts for the five different
subprojects are shown in
Output 4.15.1. The MINDATE= and MAXDATE= options have been specified to
ensure a consistent date range across projects. Notice that the TITLE2
statement uses the text substitution option #BYVARn, which substitutes
the name of the nth BY variable. The BY-LINE that appears below
the titles identifies the current values of the BY variables.
You can
suppress this using the NOBYLINE option in an OPTION statement or the
HBY option in a GOPTIONS statement. The SPLIT= option is specified to
prevent the TASK variable label from being split on the embedded blank.
title f=swiss 'Gantt Example 15';
data widgetn;
label task = "Activity Name";
merge widget details;
run;
proc cpm date='02dec91'd data=widgetn;
activity task;
duration days;
successor succ1 succ2 succ3;
id dept;
run;
proc sort;
by dept e_start;
title2 f=swiss 'Project Schedules by #BYVAR1';
proc gantt split='/';;
chart / pcompress scale=1 dur=days
mindate='02dec91'd maxdate='12feb92'd
font=swiss ;
by dept;
id task;
run;
Output 4.15.1: Using BY Processing for Separate Gantt Charts
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.