Course Scheduling Project

 /****************************************************************/
 /*          S A S   S A M P L E   L I B R A R Y                 */
 /*                                                              */
 /*    NAME: PMEX09                                              */
 /*   TITLE: Course Scheduling Project                           */
 /* PRODUCT: OR                                                  */
 /*  SYSTEM: ALL                                                 */
 /*    KEYS: CPM                                                 */
 /*   PROCS: CPM, NETDRAW, GANTT, SORT, PRINT                    */
 /*    DATA:                                                     */
 /*                                                              */
 /* SUPPORT:                             UPDATE:                 */
 /*     REF: Example 9 of Project Management Examples Book       */
 /*    MISC:                                                     */
 /*                                                              */
 /****************************************************************/

goptions border hpos=80 vpos=43
         fby=swiss
         ftitle=swiss
         htitle=2
         ftext=swiss
         htext=1.5;

pattern1 v=e c=blue;
pattern2 v=e c=blue;
pattern3 v=solid c=red;
pattern4 v=e c=red;
pattern5 v=x2 c=red;
pattern6 v=solid c=green;
pattern7 v=e c=magenta;
pattern8 v=solid c=magenta;
pattern9 v=x1 c=cyan;

title 'Software Training Center';

data crsdata;
     input name $ course $ 6-30
     cary chicago nyc wash;
cards;
AF    Menu Driven Applications  .   1   1   1
AF    Menu Driven Applications  .   1   1   1
GRAPH Color Graphics            1   .   .   .
GRAPH Color Graphics            1   .   .   .
GRAPH Color Graphics            .   1   1   1
GRAPH Color Graphics            .   1   1   1
GRAPH Color Graphics            .   1   1   1
PM    Project Management        1   .   .   .
PM    Project Management        1   .   .   .
PM    Project Management        .   1   1   1
;

data sitedate;
     format date date7.;
     informat date date7.;
     input date cary chicago nyc wash;
cards;
     11FEB91   1   1   1   0
     16FEB91   0   0   0   0
     18FEB91   1   1   1   1
     23FEB91   0   0   0   0
     25FEB91   1   0   0   1
     02MAR91   0   0   0   0
     04MAR91   1   1   1   1
;

data crsmodel;
     set crsdata;
     drop i;
     length activity $8;
     retain duration 3;
     success=' ';
     array loc{4} cary--wash;
     array site{10} site1-site10;
     do i=1 to 10;
        site{i}=.;
     end;
     site{_N_}=1;
     activity='A'||left(put(_N_,2.));
     do i=1 to 4;
        loc{i}=.;
     end;
run;

data altres;
     set crsdata;
     drop name course;
     length obstype $8.;
     array site{10} site1-site10;
     array loc{4} cary--wash;
     resid = 'SITE'||left(put(_N_,2.));
     obstype='ALTRATE';
run;

data resin;
     set altres sitedate;
     if obstype = ' ' then obstype = 'RESLEVEL';
run;

proc cpm data=crsmodel date='08jan91'd
     resourcein=resin out=crssched;
     activity activity;
     duration duration;
     successor success;
     resource cary--wash site1-site10 /
     period=date obstype=obstype resid=resid
     noe_start nol_start;
     id name course;
run;

data temp;
     set crssched;
     label1 = 'Cary, NC';
     label2 = 'Chicago, IL';
     label3 = 'New York, NY';
     label4 = 'Washington, DC';
     array uloc{4} ucary--uwash;
     array label{4} label1-label4;
     label course = 'Name of Course'
           location = 'Location'
           s_start = 'Start Date'
           s_finish = 'Finish Date';
     do i=1 to 4;
        if uloc{i} ne . then location=label{i};
     end;
run;

title2 'Schedule and Locations for Courses';

proc sort;
     by s_start;
run;

proc print label;
     var course location s_start s_finish;
run;

proc gantt data=temp graphics;
     chart/compress nolegend dupok
     nojobnum scale=5 skip=2
     ref='11feb91'd to '07mar91'd by day;
     id course location;
run;

proc sort data=temp;
by location;
run;

proc netdraw data=temp graphics;
actnet/compress activity=activity successor=(success)
nodefid nolabel id=(course s_start s_finish) timescale
zone=location;
run;