Sequential Scheduling of Projects (intpme07)

/****************************************************************/
/*          S A S   S A M P L E   L I B R A R Y                 */
/*                                                              */
/*    NAME: INTPME07                                            */
/*   TITLE: Sequential Scheduling of Projects (intpme07)        */
/* PRODUCT: OR                                                  */
/*  SYSTEM: ALL                                                 */
/*    KEYS:                                                     */
/*   PROCS: CPM, PRINT                                          */
/*    DATA:                                                     */
/*                                                              */
/* SUPPORT:                             UPDATE:                 */
/*     REF: Example 7 from the chapter, Introduction to Project */
/*           Management.                                        */
/*    MISC:                                                     */
/*                                                              */
/****************************************************************/

data book;
   length task succ $8.;
   input id $ 1-16 task $ 20-23 dur succ $ 29-32
         editor  artist;
   datalines;
Preliminary Edit   PEDT  1  REV   1   .
Preliminary Edit   PEDT  1  GRPH  1   .
Revise Book        REV   2  CEDT  1   .
Graphics           GRPH  3  CEDT  .   1
Copyedit Book      CEDT  1  PRF   1   .
Proofread Book     PRF   1  PRNT  1   .
Print Book         PRNT  2        .   .
;

data book1;
   set book;
   subproj = "Book 1";
   act  = "B1"||task;
   if succ ^= " " then succ = "B1"||succ;
   run;

data book2;
   set book;
   subproj = "Book 2";
   act  = "B2"||task;
   if act  = "B2PEDT" then dur = 2;
   if succ ^= " "    then succ = "B2"||succ;
   run;

data resource;
   input avdate date7. editor artist;
   format avdate date7.;
   datalines;
1jan03   1   1
;

/* Schedule the higher priority project first */
proc cpm data=book1 resin=resource
         out=bk1schd resout=bk1out
         date='1jan03'd interval=week;
   act      act;
   dur      dur;
   succ     succ;
   resource editor artist / per=avdate avp rcp;
   id       id;
   run;

title 'Schedule for sub-project BOOK1';
proc print data=bk1schd;
   run;

title 'Resource Usage for sub-project BOOK1';
proc print data=bk1out;
   run;

/* Construct the Resource availability data set */
/* with proper resource names                   */
data remres;
   set bk1out;
   avdate=_time_;
   editor=aeditor;
   artist=aartist;
   keep avdate editor artist;
   format avdate date7.;
   run;

proc cpm data=book2 resin=remres
         out=bk2schd resout=bk2out
         date='1jan03'd interval=week;
   act      act;
   dur      dur;
   succ     succ;
   resource editor artist / per=avdate avp rcp;
   id       id;
   run;

title 'Schedule for sub-project BOOK2';
proc print data=bk2schd;
   run;

title 'Resource Usage for sub-project BOOK2';
proc print data=bk2out;
   run;