Project Scheduling and Reporting (intpme03)

/****************************************************************/
/*          S A S   S A M P L E   L I B R A R Y                 */
/*                                                              */
/*    NAME: INTPME03                                            */
/*   TITLE: Project Scheduling and Reporting (intpme03)         */
/* PRODUCT: OR                                                  */
/*  SYSTEM: ALL                                                 */
/*    KEYS:                                                     */
/*   PROCS: CPM, GANTT                                          */
/*    DATA:                                                     */
/*                                                              */
/* SUPPORT:                             UPDATE:                 */
/*     REF: Example 3 from the chapter, Introduction to Project */
/*           Management.                                        */
/*    MISC:                                                     */
/*                                                              */
/****************************************************************/

data survey;
   input id        $ 1-20
         activity  $ 22-29
         duration
         succ1     $ 34-41
         succ2     $ 43-50
         succ3     $ 52-59
         phase     $ 61-69;
   label phase = 'Project Phase'
         id    = 'Description';
   datalines;
Plan Survey          plan sur 4  hire per design q          Plan
Hire Personnel       hire per 5  trn per                    Prepare
Design Questionnaire design q 3  trn per  select h print q  Plan
Train Personnel      trn per  3  cond sur                   Prepare
Select Households    select h 3  cond sur                   Prepare
Print Questionnaire  print q  4  cond sur                   Prepare
Conduct Survey       cond sur 10 analyze                    Implement
Analyze Results      analyze  6                             Implement
;

data holidata;
   format hol date7.;
   hol = '4jul03'd;
run;


proc cpm data=survey date='1jul03'd out=survschd
         interval=weekday holidata=holidata;
   activity   activity;
   successor  succ1-succ3;
   duration   duration;
   id         id phase;
   holiday    hol;
   run;

proc sort;
   by e_start;
run;

title  'Conducting a Market Survey';
title2 'Early and Late Start Schedule';

proc print;
run;

goptions hpos=80 vpos=43;
pattern1 c=green v=s;     /* duration of a non-critical activity   */
pattern2 c=green v=e;     /* slack time for a noncrit. activity    */
pattern3 c=red   v=s;     /* duration of a critical activity       */
pattern4 c=magenta v=e;   /* slack time for a supercrit. activity  */
pattern5 c=magenta v=s;   /* duration of a supercrit. activity     */
pattern6 c=cyan v=s;      /* actual duration of an activity        */
pattern7 c=black v=e;     /* break due to a holiday                */

title c=black h=2.5 'Conducting a Market Survey';
title2 c=black h=1.5 'Early and Late Start Schedule';
proc gantt graphics data=survschd holidata=holidata;
   chart / holiday=(hol) interval=weekday
           skip=2 height=1.4 nojobnum
           compress noextrange
           activity=activity succ=(succ1-succ3)
           cprec=blue caxis=black ;
   id   id phase;
   run;