The DTREE Procedure

Displaying the Decision Tree

PROC DTREE draws the decision tree either in line-printer mode or in graphics mode. However, you need to have SAS/GRAPH software licensed at your site to use graphics mode. In many cases, the procedure draws the decision tree across page boundaries. If the decision tree diagram is drawn on multiple pages, the procedure numbers each page of the diagram on the upper right corner of the page (unless the NOPAGENUM option is specified). The pages are numbered starting with the upper left corner of the entire diagram. Thus, if the decision tree diagram is broken into three horizontal and four vertical levels and you want to paste all the pieces together to form one picture, they should be arranged as shown in Figure 7.10.

Figure 7.10: Page Layout of the Decision Tree Diagram

LaTeX defined picture


The number of pages that are produced depends on the size of the tree and on the number of print positions that are available in the horizontal and vertical directions. Table 7.14 lists all options you can use to control the number of pages.

Table 7.14: Options That Control the Number of Pages

Option

Effect

DISPLAY=

Amounts of information displayed on the diagram

MAXPREC=

Maximum decimal width allowed (the precision) to format numerical values into $w.d$ format

MAXWIDTH=

Maximum field width allowed to format numerical values

NOLABEL

No labels are displayed on the diagram

NWIDTH=

Maximum field width allowed to format outcome names

YBETWEEN=

Vertical spaces between two successive end nodes


If the GRAPHICS option is used, the following options can be used to control the number of pages:

  • The COMPRESS option draws the entire decision tree on one page.

  • The HSYMBOL= option controls the height of all symbols.

  • The HTEXT= option controls the height of text in the tree.

  • The HEIGHT= option in a SYMBOL definition specifies the height of a symbol.

  • The HTEXT= option in a GOPTIONS statement specifies the height of all text.

  • The HTITLE= option in a GOPTIONS statement specifies the height of the first title line.

  • The HPOS= and VPOS= options in a GOPTIONS statement change the number of rows and columns.

The font used for all text can also affect the number of pages needed. Some fonts take more space than others.

If the decision tree diagram is produced on a line printer, you can use the FORMCHAR= option to control the appearance of the links and the junctions of the diagram. When you specify the GRAPHICS option, several options are available to enhance the appearance of the decision tree diagram. These are described in the section Graphics Options. In addition, many other options are available in the GOPTIONS and SYMBOL statements for controlling the details of graphics output. See the relevant chapters in SAS/GRAPH Software: Reference for a detailed discussion of the GOPTIONS and SYMBOL statements. ODS graphical styles can be applied to the decision tree diagram; see the section ODS Style Templates for more information.

Table 7.15, Table 7.16, and Table 7.17 show the relationship among the options for controlling the appearance of texts, nodes, and links, respectively. The order that PROC DTREE uses in determining which option is in effect is also provided. The order assumes that the GSTYLE system option is in effect; if that is not the case, then the steps that refer to ODS style templates are ignored. Names with arguments indicate style elements and attributes of the current ODS style template. For example, GraphDataText('Font') refers to the Font attribute of the GraphDataText element.

For ODS purposes, the label of the decision tree diagram drawn in line-printer quality is Treeplot.

Table 7.15: Options That Control Text Appearance

Object

Specification

 

Search Order

Text

Font

1.

The FTEXT= option

   

2.

The FTEXT= option in a GOPTIONS statement

   

3.

GraphDataText('Font')

   

4.

Hardware font

 

Color

1.

The CTEXT= option

   

2.

The CTEXT= option in a GOPTIONS statement

   

3.

GraphDataText('ContrastColor')

   

4.

The first color in the colors list

 

Height

1.

The value of the HTEXT= option$^1$ times the value of the HTEXT= option$^2$ in a GOPTIONS statement


$\quad ^1$If this option is not specified, the default value 1 is used.

$\quad ^2 $The default value of this option is 1 unit.

Table 7.16: Options That Control Node Appearance

Object

Specification

 

Search Order

Chance

Symbol

1.

The VSYMBOLC= option

Nodes

 

2.

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

   

3.

The default symbol, CIRCLE

 

Color

1.

The CSYMBOLC= option

   

2.

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

   

3.

The CSYMBOL= option in a GOPTIONS statement

   

4.

GraphData1('ContrastColor')

   

5.

The fifth color in the colors list

 

Height

1.

h times the value of the HEIGHT= option in the mth generated SYMBOL definition, if both HSYMBOL=h and SYMBOLC=m are specified

   

2.

The HSYMBOL= option, if it is specified

   

3.

The HEIGHT= option in the mth generated symbol definition, if SYMBOLC=m is specified

   

4.

The default value, 1 cell

Decision

Symbol

1.

The VSYMBOLD= option

Nodes

 

2.

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

   

3.

The default value, SQUARE

 

Color

1.

The CSYMBOLD= option

   

2.

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

   

3.

The CSYMBOL= option in a GOPTIONS statement

   

4.

GraphData5('ContrastColor')

   

5.

The fourth color in the colors list

 

Height

1.

h times the value of the HEIGHT= option in the dth generated SYMBOL definition, if both HSYMBOL=h and SYMBOLD=d are specified

   

2.

The HSYMBOL= option, if it is specified

   

3.

The HEIGHT= option in the dth generated symbol definition, if SYMBOLD=d is specified

   

4.

The default value, 1 cell

End

Symbol

1.

The VSYMBOLE= option

Nodes

 

2.

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

   

3.

The default value, DOT

 

Color

1.

The CSYMBOLE= option

   

2.

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

   

3.

The CSYMBOL= option in a GOPTIONS statement

   

4.

GraphData8('ContrastColor')

   

5.

The sixth color in the colors list

 

Height

1.

h times the value of the HEIGHT= option in the nth generated SYMBOL definition, if both HSYMBOL=h and SYMBOLE=n are specified

   

2.

The HSYMBOL= option, if it is specified

   

3.

The HEIGHT= option in the nth generated symbol definition, if SYMBOLE=n is specified

   

4.

The default value, 1 cell


Table 7.17: Options That Control Link Appearance

Object

Specification

 

Search Order

Links

Type

1.

The LSTYLE= option

for

 

2.

The LINE= option in the ith generated SYMBOL

Regular

   

definition, if LINKA=i is specified

Outcomes

 

3.

The default value, 1 (solid line)

 

Color

1.

The CLINK= option

   

2.

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

   

3.

GraphData3('ContrastColor')

   

4.

The third color in the colors list

 

Thickness

1.

The LWIDTH= option

   

2.

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

   

3.

The default value, 1

Links

Type

1.

The LSTYLEB= option

for

 

2.

The LINE= option in the jth generated SYMBOL

Optimal

   

definition, if LINKB=j is specified

Decision

 

3.

The default value, 1 (solid line)

 

Color

1.

The CBEST= option

   

2.

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

   

3.

GraphData2('ContrastColor')

   

4.

The second color in the colors list

 

Thickness

1.

The LWIDTHB= option

   

2.

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

   

3.

2 times the thickness of links that represent regular outcomes

Links

Type

1.

The LSTYLEC= option

That

 

2.

The LINE= option in the kth generated SYMBOL

Fall

   

definition, if LINKC=k is specified

across

 

3.

The default value, 2 (dot line)

Pages

Color

1.

Depends on whether or not it represents an optimal decision

 

Thickness

1.

Depends on whether or not it represents an optimal decision