Contract Bidding Problem (dtreee03)

 /**************************************************************/
 /*          S A S   S A M P L E   L I B R A R Y               */
 /*                                                            */
 /*    NAME: DTREEE03                                          */
 /*   TITLE: Contract Bidding Problem (dtreee03)               */
 /* PRODUCT: OR                                                */
 /*  SYSTEM: ALL                                               */
 /*    KEYS: DTREE                                             */
 /*   PROCS: DTREE                                             */
 /*    DATA:                                                   */
 /*                                                            */
 /* SUPPORT:                             UPDATE:               */
 /*     REF: Example 3 from the DTREE chapter                  */
 /*    MISC:                                                   */
 /*                                                            */
 /**************************************************************/

goptions hpos=80 vpos=32;

/* -- create the STAGEIN= data set                    -- */
data Stage3;
format _STNAME_ $14. _STTYPE_ $2. _OUTCOM_ $15.
     _SUCCES_ $14. _REWARD_ dollar8.0 ;
input _STNAME_ $16. _STTYPE_ $4. _OUTCOM_ $16.
    _SUCCES_ $16. _REWARD_ dollar8.0 ;
datalines;
Choose          D   Build_Prototype Cost_Prototype       .
.               .   No_Prototype    Bid                  .
Cost_Prototype  C   Expensive       Bid              -$4,500
.               .   Moderate        Bid              -$2,500
.               .   Inexpensive     Bid              -$1,000
Bid             D   High_Bid        Contract             .
.               .   Low_Bid         Contract             .
Contract        C   Win_Contract    .                    .
.               .   Lose_Contract   .                    .
;

/* -- create the PROBIN= data set                     -- */
data Prob3;
format _GIVEN1_ $15. _GIVEN2_ $15. _EVENT_ $14. ;
input (_GIVEN1_ _GIVEN2_ _EVENT_) ($) _PROB_;
datalines;
.               .               Expensive       0.4
.               .               Moderate        0.5
.               .               Inexpensive     0.1
Build_Prototype High_Bid        Win_Contract    0.4
Build_Prototype High_Bid        Lose_Contract   0.6
Build_Prototype Low_Bid         Win_Contract    0.8
Build_Prototype Low_Bid         Lose_Contract   0.2
No_Prototype    High_Bid        Win_Contract    0.2
No_Prototype    High_Bid        Lose_Contract   0.8
No_Prototype    Low_Bid         Win_Contract    0.7
No_Prototype    Low_Bid         Lose_Contract   0.3
;

/* -- create the PAYOFFS= data set                    -- */
data Payoff3;
format _STATE1_ _STATE2_ $12.;
input (_STATE1_ _STATE2_ _ACTION_) ($16.)
    _VALUE_  dollar8.0;
datalines;
Win_Contract    .               Low_Bid         $35,000
Win_Contract    .               High_Bid        $75,000
Win_Contract    Expensive       Low_Bid         $25,000
Win_Contract    Expensive       High_Bid        $65,000
Win_Contract    Moderate        Low_Bid         $35,000
Win_Contract    Moderate        High_Bid        $75,000
Win_Contract    Inexpensive     Low_Bid         $45,000
Win_Contract    Inexpensive     High_Bid        $85,000
;

goptions ctext=black;
goptions hsize=10in htext=3.0;
 /* -- define title                                    -- */
title1 h=2 "Contract Bidding Example" ;

 /* -- PROC DTREE statements                           -- */
proc dtree stagein=Stage3 probin=Prob3 payoffs=Payoff3
     graphics
     nowarning
     ;
  evaluate;
  treeplot / name="dt3" compress ybetween=1 cell
             hsymbol=6
             lstyleb=3 lwidth=1 lwidthb=1;
quit;