The DTREE Procedure

PROC DTREE Statement

  • PROC DTREE options;

The options that can appear in the PROC DTREE statement are listed in the following section. The options specified in the PROC DTREE statement remain in effect for all statements until the end of processing or until they are changed by a RESET statement. These options are classified under appropriate headings: first, all options that are valid for all modes of the procedure are listed followed by the options classified according to the mode (line-printer or graphics) of invocation of the procedure.

General Options

AUTOSCALE $\mid $ NOSCALE

specifies whether the procedure should rescale the probabilities of events for a given chance stage if the total probability of this stage is not equal to 1. The default is NOSCALE.

CRITERION=i

indicates the decision criterion to be used for determining the optimal decision and the certain equivalent for replacing uncertainties. The following table shows all valid values of i and their corresponding decision criteria and certain equivalents.

Table 7.5: Values for the CRITERION= Option

i

Criterion

Certain Equivalent

MAXEV

Maximize

Expected value

MINEV

Minimize

Expected value

MAXMLV

Maximize

Value with largest probability

MINMLV

Minimize

Value with largest probability

MAXCE

Maximize

Certain equivalent value of expected utility

MINCE

Minimize

Certain equivalent value of expected utility


The default value is MAXEV. The last two criteria are used when your utility curve can be fit by an exponential function. See the section Evaluation for more information on the exponential utility function.

DISPLAY=(information-list)

specifies information that should be displayed on each link of the decision tree diagram. Table 7.6 lists the valid keywords and corresponding information.

Table 7.6: Information on Decision Tree and Keywords

Keyword

Information

ALL

All information listed in this table

CR

Cumulative rewards of outcomes on the path that leads to the successor of the link

EV

Evaluating value that can be expected from the successor of the link

LINK

Outcome name represented by the link

P

Probability of the outcome represented by the link

R

Instant reward of the outcome represented by the link

STAGE

Stage name of the successor of the link


The default value is (LINK P EV R CR).

Note that the probability information displays on links that represent chance outcomes only. In addition, the PROBIN= option must be specified. The expected values display only if the decision tree has been evaluated. The reward information displays on a link only if the instant reward of the outcome represented by the link is nonzero. The cumulative rewards do not display if the cumulative rewards of links are all zero.

ERRHANDLE=DRAIN $\mid $ QUIT

specifies whether the procedure should stop processing the current statement and wait for next statement or quit PROC DTREE when an error has been detected by the procedure. The default value is DRAIN.

GRAPHICS

creates plots for a graphics device. To specify this option, you need to have SAS/GRAPH software licensed at your site. This is the default.

LABEL $\mid $ NOLABEL

specifies whether the labels for information displayed on the decision tree diagram should be displayed. If the NOLABEL option is not specified, the procedure uses the following symbols to label all the information that is displayed on each link.

Table 7.7: Labels and Their Corresponding Information

Label

Information

cr=

The cumulative rewards of outcomes on the path that lead to the successor of the link

EV=

The value that can be expected from the successor of the link

p=

The probability of the outcome represented by the link

r=

The instant reward of the outcome


The default is LABEL.

LINEPRINTER
LP

creates plots of line-printer quality. If you do not specify this option, graphics plots are produced.

MAXPREC=d

specifies the maximum decimal width (the precision) in which to format numerical values using w.d format. This option is used in displaying the decision tree diagrams and the summaries. The value for this option must be no greater than 9; the default value is 3.

MAXWIDTH=mw

specifies the maximum field width in which to format numerical values (probabilities, rewards, cumulative rewards and evaluating values) using $w.d$ format. This option is used in displaying the decision tree diagrams and the summaries. The value for this option must be no greater than 16 and must be at least 5 plus the value of the MAXPREC= option. The default value is 10.

NWIDTH=nw

specifies the maximum field width in which to format outcome names when displaying the decision tree diagrams. The value for this option must be no greater than 40; the default value is 32.

PAYOFFS=SAS-data-set

names the SAS data set that contains the evaluating values (payoffs, losses, utilities, and so on) for each state and action combination. The use of PAYOFFS= is optional in the PROC DTREE statement. If the PAYOFFS= option is not used, PROC DTREE assumes that all evaluating values at the end nodes of the decision tree are 0.

PROBIN=SAS-data-set

names the SAS data set that contains the (conditional) probability specifications of outcomes. The PROBIN= SAS data set is required if the evaluation of the decision tree is desired.

RT=r

specifies the value of the risk tolerance. The RT= option is used only when CRITERION= MAXCE or CRITERION= MINCE is specified. If the RT= option is not specified, and CRITERION= MAXCE or CRITERION= MINCE is specified, PROC DTREE changes the value of the CRITERION= option to MAXEV or MINEV (which would mean straight-line utility function and imply infinite risk tolerance).

STAGEIN=SAS-data-set

names the SAS data set that contains the stage names, stage types, names of outcomes, and their rewards and successors for each stage. If the STAGEIN= option is not specified, PROC DTREE uses the most recently created SAS data set.

SUMMARY $\mid $ NOSUMMARY

specifies whether an optimal decision summary should be displayed each time the decision tree is evaluated. The decision summary lists all paths through the tree that lead to the target stage as well as the cumulative rewards and the evaluating values of all alternatives for that path. The alternative with optimal evaluating value for each path is marked with an asterisk (*). The default is NOSUMMARY.

TARGET=stage

specifies the decision stage up to which the optimal decision policy table is displayed. The TARGET= option is used only in conjunction with the SUMMARY option. The stage specified must be a decision stage. If the TARGET= option is not specified, the procedure displays an optimal decision policy table for each decision stage.

TOLERANCE=d

specifies either a positive number close to 0 or greater than 1. PROC DTREE treats all numbers within e of 0 as 0, where

\[ e = \left\{ \begin{array}{ll} d & \mbox{if }\Argument{d} < 1 \\ d \times \epsilon & \mbox{otherwise} \end{array} \right. \]

and $\epsilon $ is the machine epsilon. The default value is 1,000.

WARNING $\mid $ NOWARNING

specifies whether the procedure should display a warning message when

  • the payoff for an outcome is not assigned in the PAYOFFS= data set

  • probabilities of events for a given chance stage have been automatically scaled by PROC DTREE because the total probability of the chance stage does not equal 1

The default is WARNING.

YBETWEEN=ybetween <units>

specifies the vertical distance between two successive end nodes. If the GRAPHICS option is specified, the valid values for the optional units are listed in Table 7.8.

Table 7.8: Valid Values for the Units of the YBETWEEN= Option

Unit

Description

CELL

Character cells

CM

Centimeters

INCH

Inches

PCT

Percentage of the graphics output area

SPACE

Height of the box surrounding the node, its predecessor link, and all text information


The value of the YBETWEEN= option must be greater than or equal to 0. Note that if the COMPRESS option is specified, the actual distance between two successive end nodes is scaled by PROC DTREE and may not be the same as the YBETWEEN= specification.

If the LINEPRINTER option is specified, the optional units value can be CELL or SPACE. The value of the YBETWEEN= option must be a nonnegative integer.

If you do not specify units, a unit specification is determined in the following order:

  • the GUNIT= option in a GOPTIONS statement, if the GRAPHICS option is specified

  • the default unit, CELL

The default value of YBETWEEN= option is 0.

Graphics Options

The following options are specifically for the purpose of producing a high-resolution quality decision tree diagram.

ANNOTATE=SAS-data-set
ANNO=SAS-data-set

specifies an input data set that contains appropriate Annotate variables. The ANNOTATE= option enables you to add features (for example, customized legend) to plots produced on graphics devices. For additional information, refer to the chapter on the annotate data set in SAS/GRAPH Software: Reference.

CBEST=color
CB=color

specifies the color for all links in the decision tree diagram that represent optimal decisions. If you do not specify the CBEST= option, the color specification is determined in the following order:

  • the CI= option in the jth generated SYMBOL definition, if the option LINKB= j is specified

  • the ContrastColor attribute of the GraphData2 element of the current ODS style template (if the GSTYLE system option is active)

  • the second color in the colors list

CLINK=color
CL=color

specifies the color for all links in the decision tree diagram except those that represent optimal decisions. If the CLINK= option is not specified, the color specification is determined in the following order:

  • the CI= option in the ith generated SYMBOL definition, if the option LINKA= i is specified

  • the ContrastColor attribute of the GraphData3 element of the current ODS style template (if the GSTYLE system option is active)

  • the third color in the colors list

COMPRESS $\mid $ NOCOMPRESS
CP $\mid $ NOCP

specifies whether the decision tree diagram should be drawn on one physical page. If the COMPRESS option is specified, PROC DTREE determines the scale so that the diagram is compressed, if necessary, to fit on one physical page. Otherwise, the procedure draws the diagram across multiple pages if necessary. The default is NOCOMPRESS.

CSYMBOLC=color
CC=color

specifies the color of the symbol used to draw all chance nodes in the decision tree diagram. If the CSYMBOLC= option is not specified, the color specification is determined in the following order:

  • the CV= option in the mth generated SYMBOL definition, if the option SYMBOLC= m is specified

  • the CSYMBOL= option in a GOPTIONS statement

  • the ContrastColor attribute of the GraphData1 element of the current ODS style template (if the GSTYLE system option is active)

  • the fifth color in the colors list

CSYMBOLD=color
CD=color

specifies the color of the symbol used to draw all decision nodes in the decision tree diagram. If the CSYMBOLD= option is not specified, the color specification is determined in the following order:

  • the CV= option in the dth generated SYMBOL definition, if the option SYMBOLD= d is specified

  • the CSYMBOL= option in a GOPTIONS statement

  • the ContrastColor attribute of the GraphData5 element of the current ODS style template (if the GSTYLE system option is active)

  • the fourth color in the colors list

CSYMBOLE=color
CE=color

specifies the color of the symbol used to draw all end nodes in the decision tree diagram. If the CSYMBOLE= option is not specified, the color specification is determined in the following order:

  • the CV= option in the nth generated SYMBOL definition, if the option SYMBOLE= n is specified

  • the CSYMBOL= option in a GOPTIONS statement

  • the ContrastColor attribute of the GraphData8 element of the current ODS style template (if the GSTYLE system option is active)

  • the sixth color in the colors list

CTEXT=color
CT=color

specifies the color to be used for all text that appears on plots except on TITLE and FOOTNOTE lines. If the CTEXT= option is not specified, the color specification is determined in the following order:

  • the CTEXT= option in a GOPTIONS statement

  • the Color attribute of the GraphDataText element of the current ODS style template (if the GSTYLE system option is active)

  • the first color in the colors list

DESCRIPTION='string'
DES='string'

specifies a descriptive string, up to 40 characters long, that appears in the description field of the master menu of PROC GREPLAY. If the DESCRIPTION= option is omitted, the description field contains a description assigned by PROC DTREE.

DOANNOTATE $\mid $ NOANNOTATE
DOANNO $\mid $ NOANNO

specifies whether the Annotate data set should be processed. If the NOANNOTATE option is specified, the procedure does not process the Annotate data set even though the ANNOTATE= option is specified. The default is DOANNOTATE.

FTEXT=name
FONT=name

specifies the font to be used for text on plots. If you do not use this option, the font specification is determined in the following order:

  • the FTEXT= option in a GOPTIONS statement

  • the Font attribute of the GraphDataText element of the current ODS style template (if the GSTYLE system option is active)

  • the hardware font for your graphics output device

Refer to the chapter on SAS/GRAPH fonts in SAS/GRAPH Software: Reference for details about SAS/GRAPH fonts.

GOUT=SAS-catalog

specifies the name of the graphics catalog used to save the output produced by PROC DTREE for later replay. For additional information, refer to the chapter on graphics output in SAS/GRAPH Software: Reference.

HSYMBOL=h
HS=h

specifies that the height of symbols for all nodes in the decision tree diagram is h times the heights of symbols assigned by SAS/GRAPH software. You can specify the heights of decision nodes, chance nodes, and end nodes by using the HEIGHT= options in the corresponding SYMBOL statements. For example, if you specify the options HSYMBOL=2 and SYMBOLD=1 in the PROC DTREE statement and defined SYMBOL1 as

      symbol1 height=4 pct;

then all decision nodes in the decision tree diagram are sized at $2 \times 4 = 8\% $ of the graphics output area. The default value is 1.

HTEXT=h
HT=h

specifies that the height for all text in plots (except that in TITLE and FOOTNOTE statements) be h times the height of the characters assigned by SAS/GRAPH software. You can also specify character height by using the HTEXT= option in a GOPTIONS statement.

For example, if you specify the option HTEXT=0.6 in the PROC DTREE statement and also specified a GOPTIONS statement as follows

      goptions htext=2 in;

then the size of all text is $0.6 \times 2 = 1.2$ inches. For more explanation of the GOPTIONS statement, refer to the chapter on the GOPTIONS statement in SAS/GRAPH Software: Reference. The default value is 1.

IMAGEMAP=SAS-data-set

names the SAS data set that receives a description of the areas of a graph and a link for each area. This information is for the construction of HTML image maps. You use a SAS DATA step to process the output file and generate your own HTML files. The graph areas correspond to the link information that comes from the WEB= variable in the STAGEIN= data set. This gives you complete control over the appearance and structure of your HTML pages.

LEGEND $\mid $ NOLEGEND
LG $\mid $ NOLG

specifies whether the default legend should be displayed. If the NOLEGEND is not specified, the procedure displays a legend at the end of each page of the decision tree diagram. The default is LEGEND.

LINKA=i

If the LINKA=i option is specified, then PROC DTREE uses the color specified with the CI= option, the type specified with the LINE= option, and the thickness specified with the WIDTH= option in the ith generated SYMBOL definition to draw all links in the decision tree diagram, except those that indicate optimal decisions and those that are continued on subsequent pages. There is no default value for this option. The color, type, and thickness specifications may be overridden by the specifications of the CLINK= , LSTYLE= , and LWIDTH= options in the PROC DTREE statement.

Note that if you specify the LINKA=i option, PROC DTREE uses the specifications in the ith generated SYMBOL definition and not the specifications in the SYMBOLi statement. Refer to SAS/GRAPH Software: Reference for the details about creating, canceling, reviewing, and altering SYMBOL definitions.

LINKB=j

If the LINKB=j option is specified, then PROC DTREE uses the color specified with the CI= option, the type specified with the LINE= option, and the thickness specified with the WIDTH= option in the jth generated SYMBOL definition to draw all links that represent optimal decisions. There is no default value for this option. The color, type, and thickness specifications may be overridden by the specifications of the CBEST= , LSTYLEB= , and LWIDTHB= options in the PROC DTREE statement.

Note that if you specify the LINKB=j option, PROC DTREE uses the specifications in the jth generated SYMBOL definition and not the specifications in the SYMBOLj statement. Refer to SAS/GRAPH Software: Reference for the details about creating, canceling, reviewing, and altering SYMBOL definitions.

LINKC=k

If the LINKC=k option is specified, then PROC DTREE uses the type specified with the LINE= option in the kth generated SYMBOL definition to draw all links in the decision tree diagram that are continued on subsequent pages. There is no default value for this option. The color and thickness for links continued on another page indicate whether the link represents an optimal decision or not. The type specification may be overridden by the specification of the LSTYLEC= option in the PROC DTREE statement.

Note that if you specify the LINKC=k option, PROC DTREE uses the specifications in the kth generated SYMBOL definition and not the specifications in the SYMBOLk statement. Refer to SAS/GRAPH Software: Reference for the details about creating, canceling, reviewing, and altering SYMBOL definitions.

LSTYLE=l
L=l

specifies the line type (style) used for drawing all links in the decision tree diagram, except those that represent the optimal decisions and those that are continued on subsequent pages. Valid values for l are 1 through 46. If the LSTYLE= option is not specified, the type specification is determined in the following order:

  • the LINE= option in the ith generated SYMBOL definition, if the option LINKA= i is specified

  • the default value, 1 (solid line)

LSTYLEB=l2
LB=l2

specifies the line type (style) used for drawing the links in the decision tree diagram that represent optimal decisions. Valid values for l2 are 1 through 46. If the LSTYLEB= option is not specified, the type specification is determined in the following order:

  • the LINE= option in the jth generated SYMBOL definition, if the option LINKB= j is specified

  • the default value, 1 (solid line)

LSTYLEC=l3
LC=l3

specifies the line type (style) used for drawing the links in the decision tree diagram that are continued on the next subsequent pages. Valid values for l3 are 1 through 46.

If the LSTYLEC= option is not specified, the type specification is determined in the following order:

  • the LINE= option in the kth generated SYMBOL definition, if the option LINKC= k is specified

  • the default value, 2 (dot line)

LWIDTH=w
LTHICK=w

specifies the line thickness (width) used to draw all links in the decision tree diagram except those that represent the optimal decisions.

If the LWIDTH= option is not specified, the thickness specification is determined in the following order:

  • the WIDTH= option in the ith generated SYMBOL definition, if the option LINKA= i is specified

  • the default value, 1

LWIDTHB=w2
LTHICKB=w2

specifies the line thickness (width) used to draw the links in the decision tree diagram that represent optimal decisions. If the LWIDTHB= option is not specified, the thickness specification is determined in the following order:

  • the WIDTH= option in the jth generated SYMBOL definition, if the option LINKB= j is specified

  • 2 times the thickness for links that represent regular outcomes

NAME='string'

specifies a descriptive string, up to 8 characters long, that appears in the name field of the master menu of PROC GREPLAY. The default is 'DTREE '.

PAGENUM $\mid $ NOPAGENUM
PAGENUMBER $\mid $ NOPAGENUMBER

specifies whether the page numbers should be displayed in the top right corner of each page of a multipage decision tree diagram. If the NOPAGENUM is not specified, the pages are ordered from top to bottom, left to right.

The default is PAGENUM.

RC $\mid $ NORC

specifies whether the links in the decision tree diagram should be drawn with rounded corners or with rectangular corners. The default is RC.

SYMBOLC=m
SYMBC=m

If the SYMBOLC= option is specified, then PROC DTREE uses the color specified with the CV= option, the character specified with the VALUE= option, the font specified with the FONT= option, and the height specified with the HEIGHT= option in the mth generated SYMBOL definition to draw all chance nodes in the decision tree diagram. There is no default value for this option. The color and the symbol specifications may be overridden by the specification of the CSYMBOLC= and VSYMBOLC= options in the PROC DTREE statement. The height of the symbol can be changed by the HSYMBOL= option in the PROC DTREE statement.

Note that if you specify the SYMBOLC=m option, PROC DTREE uses the specifications in the mth generated SYMBOL definition and not the specifications in the SYMBOLm statement. Refer to SAS/GRAPH Software: Reference for the details about creating, canceling, reviewing, and altering SYMBOL definitions.

SYMBOLD=d
SYMBD=d

If the SYMBOLD= option is specified, then PROC DTREE uses the color specified with the CV= option, the character specified with the VALUE= option, the font specified with the FONT= option, and the height specified with the HEIGHT= option in the dth generated SYMBOL definition to draw all decision nodes in the decision tree diagram. There is no default value for this option. The color and the symbol specifications may be overridden by the specification of the CSYMBOLD= and VSYMBOLD= options in the PROC DTREE statement. The height of the characters can be changed by the HSYMBOL= option in the PROC DTREE statement.

Note that if you specify the SYMBOLD=d option, PROC DTREE uses the specifications in the dth generated SYMBOL definition and not the specifications in the SYMBOLd statement. Refer to SAS/GRAPH Software: Reference for the details about creating, canceling, reviewing, and altering SYMBOL definitions.

SYMBOLE=n
SYMBE=n

If the SYMBOLE= option is specified, then PROC DTREE uses the color specified with the CV= option, the character specified with the VALUE= option, the font specified with the FONT= option, and the height specified with the HEIGHT= option in the nth generated SYMBOL definition to draw all end nodes in the decision tree diagram. There is no default value for this option. The color and the symbol specifications may be overridden by the specification of the CSYMBOLE= and VSYMBOLE= options specified in the PROC DTREE statement. The height of the characters can be changed by the HSYMBOL= option in the PROC DTREE statement.

Note that if you specify the SYMBOLE=n option, PROC DTREE uses the specifications in the nth generated SYMBOL definition and not the specifications in the SYMBOLn statement. Refer to SAS/GRAPH Software: Reference for the details about creating, canceling, reviewing, and altering SYMBOL definitions.

VSYMBOLC=symbolc-name
VC=symbolc-name

specifies that the symbol symbolc-name from the special symbol table be used to draw all chance nodes in the decision tree diagram. If you do not specify this option, the symbol used is determined in the following order:

  • the options VALUE= and FONT= specifications in the mth generated SYMBOL definition, if the option SYMBOLC= m is specified

  • the symbol CIRCLE in the special symbol table

VSYMBOLD=symbold-name
VD=symbold-name

specifies that the symbol symbold-name from the special symbol table be used to draw all decision nodes in the decision tree diagram. If you do not specify this option, the symbol used is determined in the following order:

  • the options VALUE= and FONT= specifications in the dth generated SYMBOL definition, if the option SYMBOLD= d is specified

  • the symbol SQUARE in the special symbol table

VSYMBOLE=symbole-name
VE=symbole-name

specifies that the symbol symbole-name from the special symbol table be used to draw all end nodes in the decision tree diagram. If you do not specify this option, the symbol used is determined in the following order:

  • the options VALUE= and FONT= specifications in the nth generated SYMBOL definition, if the option SYMBOLE= n is specified

  • the symbol DOT in the special symbol table

Line-Printer Options

The following options are specifically for the purpose of producing line-printer quality decision tree diagram.

FORMCHAR<(syni-list)>= 'formchar-string'

defines characters to be used for features on line-printer plots. The syni-list is a list of numbers ranging from 1 to 13. The list identifies which features are controlled with the string characters. The formchar-string gives characters for features in syni-list. Any character or hexadecimal string can be used. By default, syni-list is omitted, and the FORMCHAR= option gives a string for all 13 features. The features associated with values of syni are listed in Table 7.9. Note that characters 4, 6, 7, 10, and 12 are not used in drawing a decision tree diagram.

Table 7.9: Features Associated with the FORMCHAR= Option

Syni

Description of Character

Feature

1

Vertical bar

Vertical link

2

Horizontal bar

Horizontal link

3

Box character (upper left)

Vertical up to horizontal turn

5

Box character (upper right)

Horizontal and down vertical joint

8

Box character (middle right)

Horizontal to split joint

9

Box character (lower left)

Vertical down to horizontal turn

11

Box character (lower right)

Horizontal and up vertical joint

13

Horizontal thick

Horizontal link that represents

   

optimal decision


As an example, the decision tree diagram in Figure 7.7 is produced by the following statement:

title "Decision Tree Showing the Effects of FORMCHAR";

data Dtoils4;
   format _STNAME_ $12. _STTYPE_  $2. _OUTCOM_ $10.
         _SUCCES_ $12.;
   input _STNAME_ $ _STTYPE_ $ _OUTCOM_ $ _SUCCES_ $;
   datalines;
Drill       D   Drill       Cost
.           .   Not_Drill   .
Cost        C   Low         Oil_Deposit
.           .   High        Oil_Deposit
Oil_Deposit C   Dry         .
.           .   Wet         .
;

proc dtree stagein=Dtoils4
           nowarning
           ;
   treeplot / formchar(1 2 3 5 8 9 11 13)='|-/*<\+='
              lineprinter display=(LINK);

quit;

Figure 7.7: Decision Tree Showing the Effects of FORMCHAR

 
Decision Tree Showing the Effects of FORMCHAR

The DTREE Procedure
Line-printer Plot

                                           Low          Dry                     
                                       /----------C-*----------E                
                             Drill     |            |   Wet                     
                          /----------C-<            \----------E                
                          |            |  High          Dry                     
              ----------D-<            \----------C-*----------E                
                          |                         |   Wet                     
                          |                         \----------E                
                          |Not_Drill                                            
                          \----------E                                          



By default, the form character list specified with the SAS system option FORMCHAR= is used; otherwise, the default is '|----|+|---+='. Refer to the chapter on the Calendar Procedure in the SAS Procedures Guide for more information.