Chapter Contents 
Previous 
Next 
The DTREE Procedure 
A decision problem for an oil wildcatter illustrates the use of the
DTREE procedure.
The oil wildcatter must decide whether or not to drill at a
given site before his option expires. He is uncertain about many
things: the cost of drilling, the extent of the oil or gas
deposits at the site, and so on. Based on the reports of his
technical staff, the hole could be `Dry
' with probability
0.5, `Wet
' with probability 0.3, and `Soaking
'
with probability 0.2. His monetary payoffs are given in the
following table.
Drill  Not Drill  
Dry  0  0 
Wet  $700,000  0 
Soaking  $1,200,000  0 
The wildcatter also learned from the reports that the cost of
drilling could be $150,000 with probability 0.2, $300,000 with
probability 0.6, and $500,000 with probability 0.2. He can gain
further relevant information about the underlying geological
structure of this site by conducting seismic soundings. A cost
control procedure that can make the probabilities of the
`High
' cost outcomes smaller (and hence, the probabilities of
the `Low
' cost outcomes larger) is also available. However,
such information and control are quite costly, about
$60,000 and $120,000, respectively. The wildcatter must
also decide whether or not to take the sounding test or the cost
control program before he makes his final decision: to drill or
not to drill.
The oil wildcatter feels that he should structure and analyze
his basic problem first: whether or not to drill. He builds a
model that contains one decision stage named `Drill
'
(with two outcomes, `Drill
' and `Not_Drill
')
and two chance stages named `Cost
' and `Oil_Deposit
'.
A representation of the model is saved in
three SAS data sets. In particular, the STAGEIN=
data set can be saved as follows:
/*  create the STAGEIN= data set  */ data Dtoils1; input _STNAME_ $12. _STTYPE_ $4. _OUTCOM_ $12. _SUCCES_ $12.; datalines; Drill D Drill Cost . . Not_Drill . Cost C Low Oil_Deposit . . Fair Oil_Deposit . . High Oil_Deposit Oil_Deposit C Dry . . . Wet . . . Soaking . ;
The structure of the decision problem is given in the Dtoils1 data set. As you apply this data set, you should be aware of the following points:
Cost
' and
`Oil_Deposit
' is arbitrary.
_ENDST_
' (the default name of the end stage)
unless the associated outcome variable (_OUTCOM_)
is also missing.
The following PROBIN= data set contains the probabilities of events:
/*  create the PROBIN= data set  */ data Dtoilp1; input _EVENT1 $12. _PROB1 _EVENT2 $12. _PROB2 _EVENT3 $12. _PROB3; datalines; Low 0.2 Fair 0.6 High 0.2 Dry 0.5 Wet 0.3 Soaking 0.2 ;
Notice that the sum of the probabilities of the events
`Low
', `Fair
', and `High
' is 1.0. Similarly, the
sum of the probabilities of the events `Dry
', `Wet
',
and `Soaking
' is 1.0.
Finally, the following statements produce the PAYOFFS= data set that lists all possible scenarios and their associated payoffs.
/*  create PAYOFFS= data set  */ data Dtoilu1; input (_STATE1_STATE3) ($12.) ; format _VALUE_ dollar12.0; /* determine the cost for this scenario */ if _STATE1='Low' then _COST_=150000; else if _STATE1='Fair' then _COST_=300000; else _COST_=500000; /* determine the oil deposit and the */ /* corresponding net payoff for this scenario */ if _STATE2='Dry' then _PAYOFF_=0; else if _STATE2='Wet' then _PAYOFF_=700000; else _PAYOFF_=1200000; /* calculate the net return for this scenario */ if _STATE3='Not_Drill' then _VALUE_=0; else _VALUE_=_PAYOFF__COST_; /* drop unneeded variables */ drop _COST_ _PAYOFF_; datalines; Low Dry Not_Drill Low Dry Drill Low Wet Not_Drill Low Wet Drill Low Soaking Not_Drill Low Soaking Drill Fair Dry Not_Drill Fair Dry Drill Fair Wet Not_Drill Fair Wet Drill Fair Soaking Not_Drill Fair Soaking Drill High Dry Not_Drill High Dry Drill High Wet Not_Drill High Wet Drill High Soaking Not_Drill High Soaking Drill ;
This data set can be displayed, as shown in Figure 3.1, with the following PROC PRINT statements:
/*  print the payoff table  */ title "Oil Wildcatter's Problem"; title3 "The Payoffs"; proc print data=Dtoilu1; run;
The $550,000 payoff associated with the scenario `Low
', `Wet
',
and `Drill
'
is a net figure; it represents a return of $700,000
for a wet hole less the $150,000 cost for drilling.
Similarly, the net return of the consequence associated with the
scenario `High
', `Soaking
', and `Drill
' is
$700,000, which is
interpreted as a return of $1,200,000 less the $500,000
`High
' cost.
Now the wildcatter can invoke PROC DTREE to evaluate his model and to find the optimal decision using the following statements:
/*  PROC DTREE statements  */ title "Oil Wildcatter's Problem"; proc dtree stagein=Dtoils1 probin=Dtoilp1 payoffs=Dtoilu1 nowarning; evaluate / summary;
The following message, which notes the order of the stages, appears on the SAS log:
NOTE: Present order of stages: Drill(D), Cost(C), Oil_Deposit(C), _ENDST_(E).

The SUMMARY option in the EVALUATE statement produces the optimal decision summary shown in Figure 3.2.
The summary shows that the best action, in the sense of maximizing the expected payoff, is to drill. The expected payoff for this optimal decision is $140,000, as shown on the summary.
Perhaps the best way to view the details of the results is to display the complete decision tree. The following statement draws the decision tree, as shown in Figure 3.3, in lineprinter format:
/* plot decision tree diagram in lineprinter mode */ OPTIONS LINESIZE=100; treeplot/ lineprinter;

Chapter Contents 
Previous 
Next 
Top 
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.