The GANTT Procedure |
Now suppose that you want to obtain individual Gantt charts for two people (Thomas and William) working on the widget manufacturing project. The data set WIDGBYGP, displayed in Output 6.16.1, contains two new variables, THOMAS and WILLIAM. Each variable has a value '1' for activities in which the person is involved and a missing value otherwise. Thus, a value of '1' for the variable THOMAS in observation number 2 indicates that Thomas is working on the activity 'Drawings.'
PROC CPM is used to schedule the project to start on December 1, 2003. A data set named PERSONS is created containing one observation per activity per person working on that activity and a new variable named PERSON containing the name of the person to which the observation pertains. For example, this new data set contains two observations for the activity 'Write Specs,' one with PERSON='Thomas' and the other with PERSON='William,' and no observation for the activity 'Approve Plan.' This data set is sorted by PERSON and E_START, and displayed in Output 6.16.2. PROC GANTT is next invoked with a BY statement to obtain individual charts for each person. The resulting Gantt charts are shown in Output 6.16.3. The BY-LINE is suppressed by specifying the NOBYLINE option in an OPTIONS statement and the name of the person corresponding to the chart is displayed in the subtitle by using the #BYVAL substitution in the TITLE2 statement.
Output 6.16.1: Data Set WIDGBYGPtitle 'Gantt Example 16'; proc cpm data=widgbyp date='1dec03'd; tailnode tail; duration days; headnode head; id task thomas william; run; data persons; set _last_; if william^=. then do; person='William'; output; end; if thomas^=. then do; person='Thomas'; output; end; drop thomas william; run; proc sort data=persons; by person e_start; run;
title2 'Data PERSONS'; proc print data=persons; run; /* suppress byline */ options nobyline; title2 'Personalized Gantt Chart for #BYVAL(person)'; proc gantt data=persons; chart / pcompress; by person; id task; run;Output 6.16.2: Data Set PERSONS
|
Output 6.16.3: Gantt Charts by Person
Copyright © 2008 by SAS Institute Inc., Cary, NC, USA. All rights reserved.