Chapter Contents

Previous

Next
SAS/AF Software: Class Dictionary

Specifying Data Bins and Display Bins in a Histogram Control

The data in a histogram are usually divided into bins that define the values ranges represented by each bar in the histogram. For example, if the data contain a range of ages from 1 to 80, and the data are divided into 8 bins, age values from 1 to 10 fall in the first bin, values 11 to 20 are in the second bin, and so on.

For each histogram variable, there are two attributes for controlling the bins. One attribute determines the number of bins used to divide the actual data values. The other attribute determines the number of bins currently displayed in the histogram; the number of bins is equal to the number of bars displayed.

Attributes Description
XDataBinExponent, YDataBinExponent, ZDataBinExponent Determine the number of bins used to divide data values in the X, Y, and Z variables.
XDisplayBinExponent, YDisplayBinExponent, ZDisplayBinExponent Determine the number of bins (bars) displayed in the histogram. The setting for the display bin cannot exceed the setting for the data bin. For example, if the data are divided into 8 bins, you cannot display more than 8 bars in the histogram.

The value you specify for a bin attribute is used as an exponential value of 2. Thus, if you specify 2, there will be 4 bins. If you specify 3, there will be 8 bins, and so on.

The XDataBinExponent, YDataBinExponent, ZDataBinExponent attributes determine how many bins are used to divide data values for the corresponding variables. For example, a setting of XDataBinExponent = 3 divides the data values for the X variable into 8 bins. If the X variable is age, and the age values in the data range from 1 to 80, age values from 1 to 10 fall in the first bin, values 11 to 20 are in the second bin, and so on.

The XDisplayBinExponent, YDisplayBinExponent, ZDisplayBinExponent attributes determine how many bars are displayed in the histogram to represent the full range of data. For example, a setting of XDisplayBinExponent = 2 displays 4 bars in the histogram. If the X variable is age, and the age values in the data range from 1 to 80, age values from 1 to 20 are represented by the first bar, values 21 to 40 are represented by the second, and so on.

The number of data bins can always be evenly distributed among the number of display bins because the number of bins of both types is always a power of 2, and the number of display bins cannot exceed the number of data bins. This means that you can choose how to optimize your application for displaying histograms. The trade off is between performance and memory.

Changing the number of data bins forces a data read because the data values must be read if they are to be divided into the appropriate bins. Changing the number of display bins, however, does not force a data read. Thus, you can improve performance by setting the largest number of data bins you anticipate using for each variable. You might want to do this for improving performance in a client/server application where you have to download the data from the server to the client application. You might be able to download the data only once, for example, when initializing the application.

However, the more data bins you have, the more memory the application needs to keep all the bins in memory. Thus, to optimize the application for memory use rather than performance, you might choose to use the smallest number of data bins you expect to need for most application functions, and set a higher number of data bins only when you actually need the increased number.


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.