DBARCHART procedure
Produces barcharts for one or two-way tables (Ruth Butler).
Options
Parameters
Description
DBARCHART produces barcharts for one or two-way tables. A transformation can be specified by the option YSCALE, in which case the data and y-axis are rescaled, but the y-axis is labelled on the original scale of the data. Bar charts of two-way tables are produced with the first factor defining the groups of bars in the chart, and the second the bars within each group. The table is specified by the TABLE parameter and the origin of the y-axis, which need not be zero, can be set with the ORIGIN parameter or with XAXIS. The PEN parameter specifies a pen, or pens, for the bars of the histogram. This can be input as a scalar if the same pen is to be used for the whole plot, or as a variate to allow the groups to be drawn in different pens; by default pens 1, 2 ... are used for the successive bars. Labelling for the key can be supplied by the DESCRIPTION parameter; if this is not set, DBARCHART uses the labels of the first classifying factor. Positions of the tick-marks on the y-axis can be specified with the YMARKS parameter or with YAXIS. Upper and lower limits for the y-axis can be defined as normal with an AXIS or YAXIS statement before DBARCHART is used.
The options of the procedure mainly control the plotting: the windows that are used for the plot (WINDOW) and for the key (KEYWINDOW), titles for the graph (TITLE) and for the key (KEYDESCRIPTION), whether the groups of bars are appended or placed side-by-side (APPEND), and whether or not to clear the screen before plotting (SCREEN). Normally values in TABLE less than ORIGIN are omitted but, if you set BELOWORIGIN=include, bars will be drawn for these values extending below the x-axis. The ORIENTATION option controls whether the bars of the histogram are plotted vertically (the default) or horizontally. When ORIENTATION=horizontal, the horizontal axis is taken to be the y-axis, so the same XAXIS and YAXIS settings can be used however the histogram is oriented.
Options: TITLE, WINDOW, KEYWINDOW, LABELS, APPEND, SCREEN, KEYDESCRIPTION, YSCALE, BELOWORIGIN, ORIENTATION.
Parameters: TABLE, ORIGIN, PEN, DESCRIPTION, YMARKS.
Method
If YSCALE is set, the expression is used to transform TABLE and ORIGIN. Any YMARKS are also transformed to find the position of the tick-marks. TABLE is then rescaled so that the ORIGIN is zero. The y-axis is set up with the labelling on the original scale of TABLE. Two-way tables are first split into one-way tables classified by the second factor of TABLE. One sub-table is produced for each level of the first factor of TABLE. The chart is then produced with a single DHISTOGRAM statement for all sub-tables. YSCALE is imported into the program by setting Y or X as a dummy, and printing the expression into a text. A new expression is then set up using this text with the EXECUTE directive. Y (or X) is then set to ORIGIN, TABLE and YMARKS in turn before the expression is calculated.