Research and Development Decision Problem

 /**************************************************************/
 /*          S A S   S A M P L E   L I B R A R Y               */
 /*                                                            */
 /*    NAME: DTREEE04                                          */
 /*   TITLE: Research and Development Decision Problem         */
 /*          (dtreee04)                                        */
 /* PRODUCT: OR                                                */
 /*  SYSTEM: ALL                                               */
 /*    KEYS: OR GRAPHICS ANNOTATE SYMBOL                       */
 /*   PROCS: DTREE                                             */
 /*    DATA:                                                   */
 /*                                                            */
 /* SUPPORT:                             UPDATE:               */
 /*     REF: Example 4 from the DTREE chapter                  */
 /*    MISC:                                                   */
 /*                                                            */
 /**************************************************************/
 goptions hpos=80 vpos=32;


/* -- create the STAGEIN= data set              -- */
data Stage4;
input _STNAME_ $ 1-16 _STTYPE_ $ 17-20
 _OUTCOM_ $ 21-32 _REWARD_ dollar12.0
 _SUCC_ $ 45-60;
datalines;
R_and_D         D   Not_Conduct .           .
.               .   Conduct     -$350,000   RD_Outcome
RD_Outcome      C   Success     .           Production
.               .   Failure     .           .
Production      D   Produce     .           Sales
.               .   Abandon     .           .
Sales           C   Great       .           .
.               .   Good        .           .
.               .   Fair        .           .
.               .   Poor        .           .
;

/* -- create the PROBIN= data set               -- */
data Prob4;
input _EVENT1_ $ _PROB1_ _EVENT2_ $12. _PROB2_;
datalines;
Success     0.6     Failure   0.4
Great       0.25    Good      0.35
Fair        0.30    poor      0.1
;

/* -- create the PAYOFFS= data set                   -- */
data Payoff4;
input _STATE_ $12. _VALUE_ dollar12.0;
datalines;
Great       $1,000,000
Good        $500,000
Fair        $200,000
Poor        -$250,000
;

/* -- create the ANNOTATE= data set for legend     -- */
data Legend;
length FUNCTION $ 8;
length STYLE $ 16;
WHEN = 'B';  POSITION='0';
XSYS='4';  YSYS='4';
input FUNCTION $ X Y STYLE & 16. SIZE COLOR $ TEXT $ & 16.;
datalines;
move       8   2.1  .               .   .       .
draw      12   2.1  .               8   red     .
label     14   2    Cumberland AMT  0.6 black   BEST ACTION
symbol     9   3.5  marker          0.6 red     A
label     14   3.2  Cumberland AMT  0.6 black   END NODE
symbol     9   4.7  marker          0.6 blue    P
label     14   4.4  Cumberland AMT  0.6 black   CHANCE NODE
symbol     9   5.9  marker          0.6 green   U
label     14   5.6  Cumberland AMT  0.6 black   DECISION NODE
label      8   7.0  Cumberland AMT  0.6 black   LEGEND:
move       5   8.5  .               .   black   .
draw      35   8.5  .               2   black   .
draw      35   1    .               2   black   .
draw       5   1    .               2   black   .
draw       5   8.5  .               2   black   .
;

   /* define symbol characteristics for chance nodes and  */
   /* links except those that represent optimal decisions */
symbol1 f=marker h=1.8 v=P c=blue w=5 l=1;

   /* define symbol characteristics for decision nodes    */
   /* and links that represent optimal decisions          */
symbol2 f=marker h=1.8 v=U cv=green ci=red w=10 l=1;

   /* define symbol characteristics for end nodes         */
symbol3 f=marker h=1.8 v=A cv=red;

   /* define graphics options                             */
goptions htext=1.2;

   /* -- define title -- */
title f='Cumberland AMT'
h=2.5 'Research and Development Decision';

   /* -- PROC DTREE statements                          -- */
proc dtree
     stagein=Stage4 probin=Prob4 payoffs=Payoff4
     criterion=maxce rt=1800000
     graphics annotate=Legend nolg ;

   evaluate;

   treeplot / linka=1 linkb=2
              symbold=2 symbolc=1 symbole=3 compress name="dt4";

quit;