Subcontracting Decision (intpme09)

/****************************************************************/
/*          S A S   S A M P L E   L I B R A R Y                 */
/*                                                              */
/*    NAME: INTPME09                                            */
/*   TITLE: Subcontracting Decision (intpme09)                  */
/* PRODUCT: OR                                                  */
/*  SYSTEM: ALL                                                 */
/*    KEYS: OR GRAPHICS                                         */
/*   PROCS: DTREE                                               */
/*    DATA:                                                     */
/*                                                              */
/* SUPPORT:                             UPDATE:                 */
/*     REF: Example 9 from the chapter, Introduction to Project */
/*           Management.                                        */
/*    MISC:                                                     */
/*                                                              */
/****************************************************************/

 /* create the STAGEIN= data set */
data stage;
   input _STNAME_ $12. _STTYPE_  $4. _OUTCOM_ $12.
         _REWARD_ dollar12.0 _SUCCES_ $12.;
   format _REWARD_ comma12. ;
   datalines;
Assignment  D   In_House    .           Complete
.           .   Consult1    -$20,000    Act_Finish
.           .   Consult2    -$17,500    Act_Finish
Complete    C   On_Time     .           Cost
.           .   Delay       -$10,000    Cost
Act_Finish  C   Early       .           .
            .   Late        .           .
            .   Delay2      -$1,000     .
Cost        C   High        .           .
.           .   Low         .           .
;

 /* create the PROBIN= data set */
data prob;
   input _GIVEN_ $12. _EVENT_ $12. _PROB_ 8.2;
   datalines;
.           High        0.5
.           Low         0.5
.           On_Time     0.6
.           Delay       0.4
Consult1    Early       0.6
Consult1    Late        0.35
Consult1    Delay2      0.05
Consult2    Early       0.5
Consult2    Late        0.4
Consult2    Delay2      0.1
;

 /* create PAYOFFS= data set */
data payoff;
   input (_STATE1-_STATE2) ($12.)
         _VALUE_           dollar12.0;
   format _VALUE_ comma12. ;
   datalines;
On_Time     High        -$12,000
On_Time     Low          -$9,500
Delay       High        -$15,000
Delay       Low         -$11,500
Early       .             $3,500
Late        .             $1,500
Delay2      .                  0
;

title "Subcontracting Decision";
title2 'The Stage Data Set';
proc print data=stage;
   run;

title2 'The Probability Data Set';
proc print data=prob;
   run;

title2 'The Payoffs Data Set';
proc print data=payoff;
   run;

title2;

title "Subcontracting Decision";
symbol1 f=marker v=P c=blue;
symbol2 f=marker v=U c=green;
symbol3 f=marker v=A c=red;

 /* PROC DTREE statements */
proc dtree stagein=stage
           probin=prob
           payoffs=payoff
           nowarning
           ;
   evaluate;
   treeplot / graphics font='Cumberland AMT'
              compress ybetween=1 cell
              lwidth=1 lwidthb=2 hsymbol=2
              symbolc=1 symbold=2 symbole=3
              lstyleb=1
              ;
quit;