The UNIVARIATE Procedure

HISTOGRAM Statement

  • HISTOGRAM <variables> </ options>;

The HISTOGRAM statement creates histograms and optionally superimposes estimated parametric and nonparametric probability density curves. You cannot use the WEIGHT statement with the HISTOGRAM statement. You can use any number of HISTOGRAM statements after a PROC UNIVARIATE statement. The components of the HISTOGRAM statement are follows.

variables

are the variables for which histograms are to be created. If you specify a VAR statement, the variables must also be listed in the VAR statement. Otherwise, the variables can be any numeric variables in the input data set. If you do not specify variables in a VAR statement or in the HISTOGRAM statement, then by default, a histogram is created for each numeric variable in the DATA= data set. If you use a VAR statement and do not specify any variables in the HISTOGRAM statement, then by default, a histogram is created for each variable listed in the VAR statement.

For example, suppose a data set named Steel contains exactly two numeric variables named Length and Width. The following statements create two histograms, one for Length and one for Width:

proc univariate data=Steel;
   histogram;
run;

Likewise, the following statements create histograms for Length and Width:

proc univariate data=Steel;
   var Length Width;
   histogram;
run;

The following statements create a histogram for Length only:

proc univariate data=Steel;
   var Length Width;
   histogram Length;
run;
options

add features to the histogram. Specify all options after the slash (/) in the HISTOGRAM statement. The options can be one of the following:

  • primary options for fitted parametric distributions and kernel density estimates

  • secondary options for fitted parametric distributions and kernel density estimates

  • general options for graphics and output data sets

For example, in the following statements, the NORMAL option displays a fitted normal curve on the histogram, and the MIDPOINTS= option specifies midpoints for the histogram:

proc univariate data=Steel;
   histogram Length / normal
                      midpoints = 5.6 5.8 6.0 6.2 6.4;
run;

Table 5 through Table 8 list the HISTOGRAM options by function. For complete descriptions, see the sections Dictionary of Options and Dictionary of Common Options.

Parametric Density Estimation Options

Table 5 lists primary options that display parametric density estimates on the histogram. You can specify each primary option once in a particular HISTOGRAM statement, and each primary option can display multiple curves from its family on the histogram.

Table 5: Primary Options for Parametric Fitted Distribution

Option Description
BETA(beta-options) Fits beta distribution with threshold parameter theta, scale parameter sigma, and shape parameters alpha and beta
EXPONENTIAL(exponential-options) Fits exponential distribution with threshold parameter theta and scale parameter sigma
GAMMA(gamma-options) Fits gamma distribution with threshold parameter theta, scale parameter sigma, and shape parameter alpha
GUMBEL(Gumbel-options) Fits gumbel distribution with location parameter mu, and scale parameter sigma
IGAUSS(iGauss-options) fFitsts inverse Gaussian distribution with location parameter mu, and shape parameter lamda
LOGNORMAL(lognormal-options) Fits lognormal distribution with threshold parameter theta, scale parameter zeta, and shape parameter sigma
NORMAL(normal-options) Fits normal distribution with mean mu and standard deviation sigma
PARETO(Pareto-options) Fits generalized Pareto distribution with threshold parameter theta, scale parameter sigma, and shape parameter alpha
POWER(power-options) Fits power function distribution with threshold parameter theta, scale parameter sigma, and shape parameter alpha
RAYLEIGH(Rayleigh-options) Fits Rayleigh distribution with threshold parameter theta, and scale parameter sigma
SB(upper S Subscript upper B-options) Fits Johnson upper S Subscript upper B distribution with threshold parameter theta, scale parameter sigma, and shape parameters delta and gamma
SU(upper S Subscript upper U-options) Fits Johnson upper S Subscript upper U distribution with threshold parameter theta, scale parameter sigma, and shape parameters delta and gamma
WEIBULL(Weibull-options) Fits Weibull distribution with threshold parameter theta, scale parameter sigma, and shape parameter c


Table 6 lists secondary options that specify parameters for fitted parametric distributions and that control the display of fitted curves. Specify these secondary options in parentheses after the primary distribution option. For example, you can fit a normal curve by specifying the NORMAL option as follows:

proc univariate;
   histogram / normal(mu=10 sigma=0.5);
run;

The MU= and SIGMA= normal-options specify the parameters mu equals 10 and sigma equals 0.5 for the curve. When the MU= and SIGMA= normal-options are not specified, the sample mean and sample standard deviation are used to estimate mu and sigma, respectively.

You can specify lists of values for secondary options to display more than one fitted curve from the same distribution family on a histogram. Option values are matched by list position. You can specify the value EST in a list of distribution parameter values to use an estimate of the parameter.

For example, the following code displays two normal curves on a histogram:

proc univariate;
   histogram / normal(mu=10 est sigma=0.5 est);
run;

The first normal distribution has the mean mu equals 10 and the standard deviation sigma equals 0.5. The second normal distribution has a mean equal to the sample mean and a standard deviation equal to the sample standard deviation.

For detailed information about the families of parametric distributions that you can fit with the HISTOGRAM statement, see the section Formulas for Fitted Continuous Distributions.

Table 6: Secondary Options for Parametric Distributions

Option Description
Traditional Graphics Options Used with All Distributions
COLOR= Specifies colors of density curves
L= Specifies line types of density curves
W= Specifies widths of density curves
General Options Used with All Distributions
CONTENTS= Specifies a table of contents entry for density curve grouping
FILL Fills area under density curve
MIDPERCENTS Prints table of midpoints of histogram intervals
NOPRINT Suppresses tables that summarize curves
PERCENTS= Lists percentages for which quantiles calculated from data and quantiles estimated from curves are tabulated
Beta-Options
ALPHA= Specifies first shape parameter alpha for beta curve
BETA= Specifies second shape parameter beta for beta curve
SIGMA= Specifies scale parameter sigma for beta curve
THETA= Specifies lower threshold parameter theta for beta curve
Exponential-Options
SIGMA= Specifies scale parameter sigma for exponential curve
THETA= Specifies threshold parameter theta for exponential curve
Gamma-Options
ALPHA= Specifies shape parameter alpha for gamma curve
ALPHADELTA= Specifies change in successive estimates of alpha at which the Newton-Raphson approximation of ModifyingAbove alpha With caret terminates
ALPHAINITIAL= Specifies initial value for alpha in the Newton-Raphson approximation of ModifyingAbove alpha With caret
MAXITER= Specifies maximum number of iterations in the Newton-Raphson approximation of ModifyingAbove alpha With caret
SIGMA= Specifies scale parameter sigma for gamma curve
THETA= Specifies threshold parameter theta for gamma curve
Gumbel-Options
EDFNSAMPLES= Specifies number of samples for EDF goodness-of-fit simulation
EDFSEED= Specifies seed value for EDF goodness-of-fit simulation
MU= Specifies location parameter mu for gumbel curve
SIGMA= Specifies scale parameter sigma for gumbel curve
IGauss-Options
EDFNSAMPLES= Specifies number of samples for EDF goodness-of-fit simulation
EDFSEED= Specifies seed value for EDF goodness-of-fit simulation
LAMBDA= Specifies shape parameter lamda for inverse Gaussian curve
MU= Specifies location parameter mu for inverse Gaussian curve
Lognormal-Options
SIGMA= Specifies shape parameter sigma for lognormal curve
THETA= Specifies threshold parameter theta for lognormal curve
ZETA= Specifies scale parameter zeta for lognormal curve
Normal-Options
MU= Specifies mean mu for normal curve
SIGMA= Specifies standard deviation sigma for normal curve
Pareto-Options
EDFNSAMPLES= Specifies number of samples for EDF goodness-of-fit simulation
EDFSEED= Specifies seed value for EDF goodness-of-fit simulation
ALPHA= Specifies shape parameter alpha for generalized Pareto curve
SIGMA= Specifies scale parameter sigma for generalized Pareto curve
THETA= Specifies threshold parameter theta for generalized Pareto curve
Power-Options
ALPHA= Specifies shape parameter alpha for power function curve
SIGMA= Specifies scale parameter sigma for power function curve
THETA= Specifies threshold parameter theta for power function curve
Rayleigh-Options
EDFNSAMPLES= specifies number of samples for EDF goodness-of-fit simulation
EDFSEED= Specifies seed value for EDF goodness-of-fit simulation
SIGMA= Specifies scale parameter sigma for Rayleigh curve
THETA= Specifies threshold parameter theta for Rayleigh curve
Johnson upper S Subscript upper B-Options
DELTA= Specifies first shape parameter delta for Johnson upper S Subscript upper B curve
FITINTERVAL= Specifies z-value for method of percentiles
FITMETHOD= Specifies method of parameter estimation
FITTOLERANCE= Specifies tolerance for method of percentiles
GAMMA= Specifies second shape parameter gamma for Johnson upper S Subscript upper B curve
SIGMA= Specifies scale parameter sigma for Johnson upper S Subscript upper B curve
THETA= Specifies lower threshold parameter theta for Johnson upper S Subscript upper B curve
Johnson upper S Subscript upper U-Options
DELTA= Specifies first shape parameter delta for Johnson upper S Subscript upper U curve
FITINTERVAL= Specifies z-value for method of percentiles
FITMETHOD= Specifies method of parameter estimation
FITTOLERANCE= Specifies tolerance for method of percentiles
GAMMA= Specifies second shape parameter gamma for Johnson upper S Subscript upper U curve
OPTBOUNDRANGE= Specifies the sampling range for parameter starting values in MLE optimization
OPTMAXITER= Specifies an iteration limit for MLE optimization
OPTMAXSTARTS= Specifies the maximum number of starting points to be used for MLE optimization
OPTPRINT Prints an iteration history for MLE optimization
OPTSEED= Specifies a seed value for MLE optimization
OPTTOLERANCE= Specifies the optimality tolerance for MLE optimization
SIGMA= Specifies scale parameter sigma for Johnson upper S Subscript upper U curve
THETA= Specifies lower threshold parameter theta for Johnson upper S Subscript upper U curve
Weibull-Options
C= Specifies shape parameter c for Weibull curve
ITPRINT Requests table of iteration history and optimizer details
MAXITER= Specifies maximum number of iterations in the Newton-Raphson approximation of ModifyingAbove c With caret
SIGMA= Specifies scale parameter sigma for Weibull curve
THETA= Specifies threshold parameter theta for Weibull curve


Nonparametric Density Estimation Options

Use the option KERNEL(kernel-options) to compute kernel density estimates. Specify the secondary options shown in Table 7 in parentheses after the KERNEL option to control features of density estimates that are requested by the KERNEL option.

Table 7: Kernel-Options

Option Description
Traditional Graphics Options
COLOR= Specifies color of the kernel density curve
L= Specifies line type used for kernel density curve
W= Specifies line width for kernel density curve
General Options
C= Specifies standardized bandwidth parameter c
FILL Fills area under kernel density curve
K= Specifies type of kernel function
LOWER= Specifies lower bound for kernel density curve
UPPER= Specifies upper bound for kernel density curve


General Options

Table 8 summarizes options for enhancing histograms.

Table 8: General HISTOGRAM Statement Options

Option Description
General Graphics Options
BARLABEL= Produces labels above histogram bars
CLIPCURVES Scales vertical axis without considering fitted curves
ENDPOINTS= Lists endpoints for histogram intervals
GRID Draws grid lines at the major tick marks on the vertical axis
HANGING Constructs hanging histogram
HREF= Specifies reference lines perpendicular to the horizontal axis
HREFLABELS= Specifies labels for HREF= lines
HREFLABPOS= Specifies vertical position of labels for HREF= lines
MIDPOINTS= Specifies midpoints for histogram intervals
NENDPOINTS= Specifies number of histogram interval endpoints
NMIDPOINTS= Specifies number of histogram interval midpoints
NOBARS Suppresses histogram bars
NOHLABEL Suppresses label for horizontal axis
NOPLOT Suppresses plot
NOVLABEL Suppresses label for vertical axis
NOVTICK Suppresses tick marks and tick mark labels for vertical axis
RTINCLUDE Includes right endpoint in interval
STATREF= Specifies reference lines at values of summary statistics
STATREFLABELS= Specifies labels for STATREF= lines
STATREFSUBCHAR= Specifies substitution character for displaying statistic values in STATREFLABELS= labels
VAXISLABEL= Specifies label for vertical axis
VREF= Specifies reference lines perpendicular to the vertical axis
VREFLABELS= Specifies labels for VREF= lines
VREFLABPOS= Specifies horizontal position of labels for VREF= lines
VSCALE= Specifies scale for vertical axis
Options for Traditional Graphics Output
ANNOTATE= Specifies annotate data set
BARWIDTH= Specifies width for the bars
CAXIS= Specifies color for axis
CBARLINE= Specifies color for outlines of histogram bars
CFILL= Specifies color for filling under curve
CFRAME= Specifies color for frame
CGRID= Specifies color for grid lines
CHREF= Specifies colors for HREF= lines
CLIPREF Draws reference lines behind histogram bars
CSTATREF= Specifies colors for STATREF= lines
CTEXT= Specifies color for text
CVREF= Specifies colors for VREF= lines
DESCRIPTION= Specifies description for plot in graphics catalog
FONT= Specifies software font for text
FRONTREF Draws reference lines in front of histogram bars
HAXIS= Specifies AXIS statement for horizontal axis
HEIGHT= Specifies height of text used outside framed areas
HMINOR= Specifies number of horizontal minor tick marks
HOFFSET= Specifies offset for horizontal axis
INFONT= Specifies software font for text inside framed areas
INHEIGHT= Specifies height of text inside framed areas
INTERBAR= Specifies space between histogram bars
LGRID= Specifies a line type for grid lines
LHREF= Specifies line types for HREF= lines
LSTATREF= Specifies line types for STATREF= lines
LVREF= Specifies line types for VREF= lines
NAME= Specifies name for plot in graphics catalog
NOFRAME Suppresses frame around plotting area
PFILL= Specifies pattern for filling under curve
TURNVLABELS Turns and vertically strings out characters in labels for vertical axis
VAXIS= Specifies AXIS statement or values for vertical axis
VMINOR= Specifies number of vertical minor tick marks
VOFFSET= Specifies length of offset at upper end of vertical axis
WAXIS= Specifies line thickness for axes and frame
WBARLINE= Specifies line thickness for bar outlines
WGRID= Specifies line thickness for grid
Options for ODS Graphics Output
BARFILL= Controls bars that fill different cells of a comparative histogram
NOCURVELEGEND Suppresses legend for curves
ODSFOOTNOTE= Specifies footnote displayed on histogram
ODSFOOTNOTE2= Specifies secondary footnote displayed on histogram
ODSTITLE= Specifies title displayed on histogram
ODSTITLE2= Specifies secondary title displayed on histogram
OVERLAY Overlays histograms for different class levels
Options for Comparative Plots
ANNOKEY Applies annotation requested in ANNOTATE= data set to key cell only
CFRAMESIDE= Specifies color for filling frame for row labels
CFRAMETOP= Specifies color for filling frame for column labels
CPROP= Specifies color for proportion of frequency bar
CTEXTSIDE= Specifies color for row labels of comparative histograms
CTEXTTOP= Specifies color for column labels of comparative histograms
INTERTILE= Specifies distance between tiles
MAXNBIN= Specifies maximum number of bins to display
MAXSIGMAS= Limits the number of bins that display to within a specified number of standard deviations above and below mean of data in key cell
NCOLS= Specifies number of columns in comparative histogram
NROWS= Specifies number of rows in comparative histogram
Miscellaneous Options
CONTENTS= Specifies table of contents entry for histogram grouping
MIDPERCENTS Creates table of histogram intervals
NOTABCONTENTS Suppresses table of contents entries for tables produced by HISTOGRAM statement
OUTHISTOGRAM= Creates a data set containing information about histogram intervals
OUTKERNEL= Creates a data set containing kernel density estimates


Dictionary of Options

The following entries provide detailed descriptions of options in the HISTOGRAM statement. Options marked with † apply only when traditional graphics are produced. For detailed descriptions of options common to all plot statements, see the section Dictionary of Common Options.

ALPHA=value-list

specifies the shape parameter alpha for fitted curves that are requested by the BETA, GAMMA, PARETO, and POWER options. Enclose the ALPHA= option in parentheses after the distribution keyword. By default, or if you specify the value EST, the procedure calculates a maximum likelihood estimate for alpha. You can specify A= as an alias for ALPHA= if you use it as a beta-option. You can specify SHAPE= as an alias for ALPHA= if you use it as a gamma-option.

BARFILL=variable-list

specifies variables whose values determine the colors of the bars in the cells of a comparative histogram. Cells that are associated with a particular value of a BARFILL= variable are the same color. The colors that are used are determined by the ODS style. If the HISTOGRAM statement applies to more than one analysis variable (which are listed in either the HISTOGRAM statement or a VAR statement), you can specify a list of BARFILL= variables, which are matched with analysis variables by their positions in the lists. Note: This option applies only when ODS Graphics is enabled.

BARLABEL=COUNT |PERCENT |PROPORTION

displays labels above the histogram bars. You can specify the following values:

COUNT

shows the number of observations associated with each bar.

PERCENT

shows the percentage of observations represented by each bar.

PROPORTION

shows the proportion of observations associated with each bar.

By default, bars are not labeled.

† BARWIDTH=value

specifies the width of the histogram bars in percentage screen units. If both the BARWIDTH= and INTERBAR= options are specified, the INTERBAR= option takes precedence.

BETA <(beta-options)>

displays fitted beta density curves on the histogram. The BETA option can occur only once in a HISTOGRAM statement, but it can request any number of beta curves. The beta distribution is bounded below by the parameter theta and above by the value theta plus sigma. Use the THETA= and SIGMA= beta-options to specify these parameters. By default, THETA=0 and SIGMA=1. You can specify THETA=EST and SIGMA=EST to request maximum likelihood estimates for theta and sigma.

The beta distribution has two shape parameters: alpha and beta. If these parameters are known, you can specify their values with the ALPHA= and BETA= beta-options. By default, the procedure computes maximum likelihood estimates for alpha and beta. Note: Three- and four-parameter maximum likelihood estimation might not always converge.

Table 6 lists secondary options you can specify with the BETA option. For more information, see the section Beta Distribution. See Example 4.21 for an example that uses the BETA option.

BETA=value-list
B=value-list

specifies the second shape parameter beta for beta density curves that are requested by the BETA option. Enclose the BETA= beta-option in parentheses after the BETA option. By default, or if you specify the value EST, the procedure calculates a maximum likelihood estimate for beta.

C=value-list
SHAPE=value-list

specifies the shape parameter c for Weibull density curves that are requested by the WEIBULL option. Enclose the C= Weibull-option in parentheses after the WEIBULL option. By default, or if you specify the value EST, the procedure calculates a maximum likelihood estimate for c.

C=value-list

specifies the standardized bandwidth parameter c for kernel density estimates that are requested by the KERNEL option. Enclose the C= kernel-option in parentheses after the KERNEL option. You can specify a list of values to request multiple estimates. You can specify the value MISE to produce the estimate with a bandwidth that minimizes the approximate mean integrated square error (MISE), or SJPI to select the bandwidth by using the Sheather-Jones plug-in method.

You can also use the C= kernel-option with the K= kernel-option (which specifies the kernel function) to compute multiple estimates. If you specify more kernel functions than bandwidths, the last bandwidth in the list is repeated for the remaining estimates. Similarly, if you specify more bandwidths than kernel functions, the last kernel function is repeated for the remaining estimates. If you do not specify the C= kernel-option, the bandwidth that minimizes the approximate MISE is used for all the estimates.

For more information about kernel density estimates, see the section Kernel Density Estimates.

† CBARLINE=color

specifies the color for the outline of the histogram bars that are produced for traditional graphics. The option does not apply to ODS Graphics output.

† CFILL=color

specifies the color to fill the bars of the histogram (or the area under a fitted density curve if you also specify the FILL option) that is produced for traditional graphics. For more information, see the FILL and PFILL= options. See SAS/GRAPH: Reference for a list of colors. The option does not apply to ODS Graphics output.

† CGRID=color

specifies the color for grid lines when a grid is displayed on the histogram in traditional graphics. This option also produces a grid if the GRID= option is not specified.

CLIPCURVES

scales the vertical axis without taking fitted curves into consideration. Curves that extend above the tallest histogram bar can be clipped. You can use this option to avoid compression of the histogram bars that can be caused by extremely high fitted curve peaks.

† CLIPREF

draws the histogram bars in front of reference lines that are requested by the HREF= and VREF= options. When the GSTYLE system option is in effect for traditional graphics, reference lines are drawn in front of the bars by default.

CONTENTS=

specifies the table of contents grouping entry for tables that are associated with a density curve. Enclose the CONTENTS= option in parentheses after the distribution option. You can specify CONTENTS='' to suppress the grouping entry.

DELTA=value-list

specifies the first shape parameter delta for Johnson upper S Subscript upper B and Johnson upper S Subscript upper U distribution functions that are requested by the SB and SU options. Enclose the DELTA= option in parentheses after the SB or SU option. If you do not specify a value for delta, or if you specify the value EST, the procedure calculates an estimate.

EDFNSAMPLES=value

specifies the number of simulation samples to use to compute p-values for empirical distribution function (EDF) goodness-of-fit statistics for density curves that are requested by the GUMBEL, IGAUSS, PARETO, and RAYLEIGH options. Enclose the EDFNSAMPLES= option in parentheses after the distribution option. By default, EDFNSAMPLES=500.

EDFSEED=value

specifies an integer value to use to start the pseudorandom number generator when creating simulation samples for computing EDF goodness-of-fit statistic p-values for density curves that are requested by the GUMBEL, IGAUSS, PARETO, and RAYLEIGH options. Enclose the EDFSEED= option in parentheses after the distribution option. By default, the procedure uses a random number seed that is generated from reading the time of day from the computer’s clock.

ENDPOINTS <=values |KEY |UNIFORM>

uses histogram bin endpoints as the tick mark values for the horizontal axis and determines how to compute the bin width of the histogram bars. You can specify the following values:

values

specifies both the left and right endpoints of each histogram interval. The width of the histogram bars is the difference between consecutive endpoints. The procedure uses the same values for all variables.

The range of endpoints must cover the range of the data. For example, if you specify

endpoints=2 to 10 by 2

then all of the observations must fall in the intervals [2,4) [4,6) [6,8) [8,10]. You must use evenly spaced endpoints that you list in increasing order.

KEY

determines the endpoints for the data in the key cell. The initial number of endpoints is based on the number of observations in the key cell by using the method of Terrell and Scott (1985). The procedure extends the endpoint list for the key cell in either direction as necessary until it spans the data in the remaining cells.

UNIFORM

determines the endpoints by using all the observations as if there were no cells. In other words, the number of endpoints is based on the total sample size by using the method of Terrell and Scott (1985).

Neither KEY nor UNIFORM apply unless you also specify the CLASS statement.

If you omit the ENDPOINTS option, the procedure uses the histogram midpoints as horizontal axis tick values. If you specify the ENDPOINTS option, the procedure computes the endpoints by using an algorithm (Terrell and Scott 1985) that is primarily applicable to continuous data that are approximately normally distributed.

If you specify both the MIDPOINTS= and ENDPOINTS options, the procedure issues a warning message and uses the endpoints.

If you specify the RTINCLUDE option, the procedure includes the right endpoint of each histogram interval in that interval instead of including the left endpoint.

If you specify a CLASS statement and specify the ENDPOINTS option, the procedure uses ENDPOINTS=KEY as the default. However if the key cell is empty, then the procedure uses ENDPOINTS=UNIFORM.

EXPONENTIAL <(exponential-options)>
EXP <(exponential-options)>

displays fitted exponential density curves on the histogram. This option can occur only once in a HISTOGRAM statement, but it can request any number of exponential curves. Use the THETA= exponential-option to specify the threshold parameter theta, which must be less than or equal to the minimum data value. By default, THETA=0. You can specify THETA=EST to request the maximum likelihood estimate for theta. Use the SIGMA= exponential-option to specify sigma. By default, the procedure computes a maximum likelihood estimate for sigma. Table 6 lists options you can specify with the EXPONENTIAL option. For more information, see the section Exponential Distribution.

FILL

fills areas under the fitted density curve or the kernel density estimate with colors and patterns. Enclose this option in parentheses after a density curve option or the KERNEL option. This option is ignored if you request more than one density curve. The CFILL= and PFILL= options specify the color and pattern for the area under the curve when producing traditional graphics. For a list of available colors and patterns, see SAS/GRAPH: Reference.

† FRONTREF

draws reference lines that are requested by the HREF= and VREF= options in front of the histogram bars. When the NOGSTYLE system option is in effect for traditional graphics, reference lines are drawn behind the histogram bars by default, and they can be obscured by filled bars.

GAMMA <(gamma-options)>

displays fitted gamma density curves on the histogram. You can specify the GAMMA option only once in a HISTOGRAM statement, but it can request any number of gamma curves. The parameter theta must be less than the minimum data value. Use the THETA= gamma-option to specify theta. By default, THETA=0. You can specify THETA=EST to request the maximum likelihood estimate for theta. Use the ALPHA= and the SIGMA= gamma-options to specify the shape parameter alpha and the scale parameter sigma. By default, PROC UNIVARIATE computes maximum likelihood estimates for alpha and sigma. The procedure calculates the maximum likelihood estimate of alpha iteratively by using the Newton-Raphson approximation. Table 6 lists options you can specify with the GAMMA option. For more information, see the section Gamma Distribution. See Example 4.22 for an example that uses the GAMMA option.

GAMMA=value-list

specifies the second shape parameter gamma for Johnson upper S Subscript upper B and Johnson upper S Subscript upper U distribution functions that are requested by the SB and SU option, respectively. Enclose the GAMMA= option in parentheses after the SB or SU option. If you do not specify a value for gamma, or if you specify the value EST, the procedure calculates an estimate.

GRID

displays a grid on the histogram. Grid lines are horizontal lines that are positioned at major tick marks on the vertical axis.

GUMBEL <(Gumbel-options)>

displays fitted Gumbel density curves on the histogram. You can specify the GUMBEL option only once in a HISTOGRAM statement, but it can request any number of Gumbel curves. Use the MU= and the SIGMA= Gumbel-options to specify the location parameter mu and the scale parameter sigma, respectively. By default, PROC UNIVARIATE computes maximum likelihood estimates for mu and sigma. Table 6 lists options you can specify with the GUMBEL option. For more information, see the section Gumbel Distribution.

HANGING
HANG

requests a hanging histogram, as illustrated in Figure 7.

Figure 7: Hanging Histogram

Hanging Histogram


The HANGING option is enabled only when you have requested exactly one fitted density curve. A hanging histogram aligns the tops of the histogram bars (displayed as lines) with the fitted curve. The lines are positioned at the midpoints of the histogram bins. A hanging histogram is a goodness-of-fit diagnostic in the sense that the closer the lines are to the horizontal axis, the better the fit. Hanging histograms are discussed by Tukey (1977), Wainer (1974), and Velleman and Hoaglin (1981).

† HOFFSET=value

specifies the offset, in percentage screen units, at both ends of the horizontal axis. You can use HOFFSET=0 to eliminate the default offset.

IGAUSS <(iGauss-options)>

displays fitted inverse Gaussian density curves on the histogram. You can specify the IGAUSS option only once in a HISTOGRAM statement, but it can request any number of inverse Gaussian curves. Use the MU= and the LAMBDA= iGauss-options to specify the location parameter mu and the shape parameter lamda, respectively. By default, PROC UNIVARIATE uses the sample mean for mu and computes a maximum likelihood estimate for lamda. Table 6 lists options you can specify with the IGAUSS option. For more information, see the section Inverse Gaussian Distribution.

† INTERBAR=value

specifies the space between histogram bars in percentage screen units. If both the INTERBAR= and BARWIDTH= options are specified, the INTERBAR= option takes precedence.

K=NORMAL |QUADRATIC |TRIANGULAR

specifies the kernel function (normal, quadratic, or triangular) used to compute a kernel density estimate. You can specify a list of values to request multiple estimates. You must enclose this option in parentheses after the KERNEL option. You can also use the K= kernel-option with the C= kernel-option, which specifies standardized bandwidths. If you specify more kernel functions than bandwidths, the procedure repeats the last bandwidth in the list for the remaining estimates. Similarly, if you specify more bandwidths than kernel functions, the procedure repeats the last kernel function for the remaining estimates. By default, K=NORMAL.

KERNEL<(kernel-options)>

superimposes kernel density estimates on the histogram. By default, the procedure uses the AMISE method to compute kernel density estimates. To request multiple kernel density estimates on the same histogram, specify a list of values for the C= kernel-option or K= kernel-option. Table 7 lists options you can specify with the KERNEL option. For more information about kernel density estimates, see the section Kernel Density Estimates and Example 4.23.

LAMBDA=value

specifies the shape parameter lamda for fitted curves that are requested by the IGAUSS option. Enclose the LAMBDA= option in parentheses after the IGAUSS distribution keyword. If you do not specify a value for lamda, the procedure calculates a maximum likelihood estimate.

† LGRID=linetype

specifies the line type for the grid when a grid is displayed on the histogram. This option also creates a grid if the GRID option is not specified.

LOGNORMAL<(lognormal-options)>

displays fitted lognormal density curves on the histogram. You can specify the LOGNORMAL option only once in a HISTOGRAM statement, but you can request any number of lognormal curves in this option.

The parameter theta must be less than the minimum data value. Use the THETA= lognormal-option to specify theta. By default, THETA=0. You can specify THETA=EST to request the maximum likelihood estimate for theta. You can use the SIGMA= and ZETA= lognormal-options to specify values for sigma and zeta. By default, the procedure computes estimates of sigma and zeta as described in the section Lognormal Distribution. Table 6 lists options you can specify with the LOGNORMAL option.

See the Example 4.22 and Example 4.24 for examples that use the LOGNORMAL option.

LOWER=value-list

specifies lower bounds for kernel density estimates that are requested by the KERNEL option. Enclose the LOWER= option in parentheses after the KERNEL option. If you specify more kernel estimates than lower bounds, the last lower bound is repeated for the remaining estimates. The default is a missing value, which indicates no lower bounds for fitted kernel density curves.

MAXNBIN=n

limits the number of bins that are displayed in the comparative histogram. This option is useful when the scales or ranges of the data distributions differ greatly from cell to cell. By default, the bin size and midpoints are determined for the key cell, and then the midpoint list is extended to accommodate the data ranges for the remaining cells. However, if the cell scales differ considerably, the resulting number of bins can be so great that each cell histogram is scaled into a narrow region. By using this option to limit the number of bins, you can narrow the window about the data distribution in the key cell. This option is not available unless you specify the CLASS statement. The MAXNBIN= option is an alternative to the MAXSIGMAS= option.

MAXSIGMAS=value

limits the number of bins that are displayed in the comparative histogram to a range of value standard deviations (of the data in the key cell) above and below the mean of the data in the key cell. This option is useful when the scales or ranges of the data distributions differ greatly from cell to cell. By default, the bin size and midpoints are determined for the key cell, and then the midpoint list is extended to accommodate the data ranges for the remaining cells. However, if the cell scales differ considerably, the resulting number of bins can be so great that each cell histogram is scaled into a narrow region. By using this option to limit the number of bins, you can narrow the window that surrounds the data distribution in the key cell. This option is not available unless you specify the CLASS statement.

MIDPERCENTS

requests a table that lists the midpoints and percentage of observations in each histogram interval. If you specify MIDPERCENTS in parentheses after a density estimate option, the procedure displays a table that lists the midpoints, the observed percentage of observations, and the estimated percentage of the population in each interval (estimated from the fitted distribution). See Example 4.18.

MIDPOINTS=values |KEY |UNIFORM

specifies how to determine the midpoints for the histogram intervals, You can specify the following values:

values

specifies a list of midpoint values. The width of the histogram bars is the difference between consecutive midpoints. The procedure uses the same values for all analysis variables. The range of midpoints, extended at each end by half of the bar width, must cover the range of the data. For example, if you specify

midpoints=2 to 10 by 0.5

then all of the observations should fall between 1.75 and 10.25. You must specify evenly spaced midpoints listed in increasing order.

KEY

determines the midpoints for the data in the key cell. The initial number of midpoints is based on the number of observations in the key cell that use the method of Terrell and Scott (1985). The procedure extends the midpoint list for the key cell in either direction as necessary until it spans the data in the remaining cells.

UNIFORM

determines the midpoints by using all the observations as if there were no cells. In other words, the number of midpoints is based on the total sample size by using the method of Terrell and Scott (1985).

Neither KEY nor UNIFORM apply unless you use the CLASS statement. By default, if you use a CLASS statement, MIDPOINTS=KEY; however, if the key cell is empty then MIDPOINTS=UNIFORM. Otherwise, the procedure computes the midpoints by using an algorithm (Terrell and Scott 1985) that is primarily applicable to continuous data that are approximately normally distributed.

MU=value-list

specifies the parameter mu for Gumbel, inverse Gaussian, and normal density curves that are requested by the GUMBEL, IGAUSS, and NORMAL options, respectively. Enclose the MU= option in parentheses after the distribution keyword. By default, or if you specify the value EST, the procedure uses the sample mean for mu for normal and inverse Gaussian distributions and computes a maximum likelihood estimate of mu for the Gumbel distribution. For more detail, see the sections Inverse Gaussian Distribution and Gumbel Distribution.

NENDPOINTS=n

uses histogram interval endpoints as the tick mark values for the horizontal axis and determines the number of bins.

NMIDPOINTS=n

specifies the number of histogram intervals.

NOBARS

suppresses drawing of histogram bars, which is useful for viewing fitted curves only.

NOCURVELEGEND
NOLEGEND

suppresses the legend for fitted curves. This option applies only to ODS Graphics output.

NOPLOT
NOCHART

suppresses the creation of a plot. Use this option when you only want to tabulate summary statistics for a fitted density or create an OUTHISTOGRAM= data set.

NOPRINT

suppresses tables summarizing the fitted curve. Enclose this option in parentheses following the distribution option.

NORMAL<(normal-options)>

displays fitted normal density curves on the histogram. You can specify the NORMAL option only once in a HISTOGRAM statement, but it can request any number of normal curves. Use the MU= and SIGMA= normal-options to specify mu and sigma. By default, the procedure uses the sample mean and sample standard deviation for mu and sigma, respectively. Table 6 lists options you can specify with the NORMAL option. For more information, see the section Normal Distribution. See Example 4.19 for an example that uses the NORMAL option.

NOTABCONTENTS

suppresses the table of contents entries for tables produced by the HISTOGRAM statement.

OPTBOUNDRANGE=value

defines the sampling range for each parameter during maximum likelihood estimation for the Johnson upper S Subscript upper U distribution. PROC UNIVARIATE computes initial estimates for each parameter by using the method of percentiles. The value determines the range of parameter values around the initial estimate that can be sampled for local optimization starting values. By default, OPTBOUNDRANGE=100.

OPTMAXITER=value

limits the number of iterations that are used by the optimizer in maximum likelihood estimation for the Johnson upper S Subscript upper U distribution. By default,OPTMAXITER=500.

OPTMAXSTARTS=N

defines the maximum number of starting points to use for local optimization in maximum likelihood estimation for the Johnson upper S Subscript upper U distribution. That is, no more than N local optimizations are used in the multi-start algorithm. By default, OPTMAXSTARTS=100.

OPTPRINT

prints the iteration history for the Johnson upper S Subscript upper U distribution maximum likelihood estimation.

OPTSEED=value

specifies a positive integer seed for generating random number sequences in Johnson upper S Subscript upper U distribution maximum likelihood estimation. You can use this option to replicate results from different runs.

OPTTOLERANCE=value

specifies the tolerance for declaring optimality in maximum likelihood estimation for the Johnson upper S Subscript upper U distribution. By default, OPTTOLERANCE=1E–8.

OUTHISTOGRAM=SAS-data-set
OUTHIST=SAS-data-set

creates a SAS data set that contains information about histogram intervals. Specifically, the data set contains the midpoints of the histogram intervals (or the lower endpoints of the intervals if you specify the ENDPOINTS option), the observed percentage of observations in each interval, and the estimated percentage of observations in each interval (estimated from each of the specified fitted curves).

OUTKERNEL=SAS-data-set

creates a SAS data set that contains information about kernel density estimates.

PARETO <(Pareto-options)>

displays fitted generalized Pareto density curves on the histogram. You can specify the this option only once in a HISTOGRAM statement, but it can request any number of generalized Pareto curves. The parameter theta must be less than the minimum data value. Use the THETA= Pareto-option to specify theta. By default, THETA=0. Use the SIGMA= and the ALPHA= Pareto-options to specify the scale parameter sigma and the shape parameter alpha. By default, PROC UNIVARIATE computes maximum likelihood estimates for sigma and alpha. Table 6 lists options you can specify with the PARETO option. For more information, see the section Generalized Pareto Distribution.

PERCENTS=values
PERCENT=values

specifies a list of percentages for which quantiles calculated from the data and quantiles estimated from the fitted curve are tabulated. The percentages must be between 0 and 100. Enclose the PERCENTS= option in parentheses after the curve option. The default percentages are 1, 5, 10, 25, 50, 75, 90, 95, and 99.

† PFILL=pattern

specifies a pattern used to fill the bars of the histograms (or the areas under a fitted curve if you also specify the FILL option) when producing traditional graphics. For more information, see the entries for the CFILL= and FILL options. Refer to SAS/GRAPH: Reference for a list of pattern values. This option does not apply to ODS Graphics output.

POWER <(power-options)>

displays fitted power function density curves on the histogram. You can specify this option only once in a HISTOGRAM statement, but it can request any number of power function curves. The parameter theta must be less than the minimum data value. Use the THETA= and SIGMA= power-options to specify theta and sigma. The default values are 0 and 1, respectively. Use the ALPHA= power-option to specify the and the shape parameter, alpha. By default, PROC UNIVARIATE computes a maximum likelihood estimate for alpha. Table 6 lists options you can specify with the POWER option. For more information, see the section Power Function Distribution.

RAYLEIGH <(Rayleigh-options)>

displays fitted Rayleigh density curves on the histogram. You can specify this option only once in a HISTOGRAM statement, but it can request any number of Rayleigh curves. The parameter theta must be less than the minimum data value. Use the THETA= Rayleigh-option to specify theta. By default, THETA=0. Use the SIGMA= Rayleigh-option to specify the scale parameter sigma. By default, PROC UNIVARIATE computes maximum likelihood estimates for sigma. Table 6 lists options you can specify with the RAYLEIGH option. For more information, see the section Rayleigh Distribution.

RTINCLUDE

includes the right endpoint of each histogram interval in that interval. By default, the left endpoint is included in the histogram interval.

SB<(upper S Subscript upper B-options)>

displays fitted Johnson upper S Subscript upper B density curves on the histogram. You can specify this option only once in a HISTOGRAM statement, but it can request any number of Johnson upper S Subscript upper B curves. Use the THETA= and SIGMA= normal-options to specify theta and sigma. By default, the procedure computes maximum likelihood estimates of theta and sigma. Table 6 lists options you can specify with the SB option. For more information, see the section Johnson SB distribution.

SIGMA=value-list

specifies the parameter sigma for the fitted density curve when you request the BETA, EXPONENTIAL, GAMMA, GUMBEL, LOGNORMAL, NORMAL, PARETO, POWER, RAYLEIGH, SB, SU, or WEIBULL options.

See Table 9 for a summary of how to use the SIGMA= option. You must enclose this option in parentheses after the density curve option. If you specify the value EST, the procedure computes an estimate of sigma as described in the section Lognormal Distribution for the lognormal distribution or a maximum likelihood estimate for all other distributions.

Table 9: Uses of the SIGMA= Option

Distribution Keyword SIGMA= Specifies Default Value Alias
BETA Scale parameter sigma 1 SCALE=
EXPONENTIAL Scale parameter sigma Maximum likelihood estimate SCALE=
GAMMA Scale parameter sigma Maximum likelihood estimate SCALE=
GUMBEL Scale parameter sigma Maximum likelihood estimate
LOGNORMAL Shape parameter sigma Estimate computed as described in the section Lognormal Distribution SHAPE=
NORMAL Scale parameter sigma Standard deviation
PARETO Scale parameter sigma 1
POWER Scale parameter sigma Maximum likelihood estimate
RAYLEIGH Scale parameter sigma Maximum likelihood estimate
SB Scale parameter sigma 1 SCALE=
SU Scale parameter sigma Percentile-based estimate
WEIBULL Scale parameter sigma Maximum likelihood estimate SCALE=


SU<(upper S Subscript upper U-options)>

displays fitted Johnson upper S Subscript upper U density curves on the histogram. You can specify this option only once in a HISTOGRAM statement, but it can request any number of Johnson upper S Subscript upper U curves. Use the THETA= and SIGMA= normal-options to specify theta and sigma. By default, the procedure computes maximum likelihood estimates of theta and sigma. Table 6 lists options you can specify with the SU option. For more information, see the section Johnson SU distribution.

THETA=value-list
THRESHOLD= value-list

specifies the lower threshold parameter theta for curves that are requested by the BETA, EXPONENTIAL, GAMMA, LOGNORMAL, PARETO, POWER, RAYLEIGH, SB, SU, and WEIBULL options. Enclose the THETA= option in parentheses after the curve option. By default, THETA=0. If you specify the value EST, an estimate is computed for theta.

UPPER=value-list

specifies upper bounds for kernel density estimates that are requested by the KERNEL option. Enclose the UPPER= option in parentheses after the KERNEL option. If you specify more kernel estimates than upper bounds, the last upper bound is repeated for the remaining estimates. The default is a missing value, indicating no upper bounds for fitted kernel density curves.

† VOFFSET=value

specifies the offset, in percentage screen units, at the upper end of the vertical axis.

VSCALE=COUNT |PERCENT |PROPORTION

specifies the scale of the vertical axis for a histogram. You can specify the following values:

COUNT

scales the data in units of the number of observations per data unit.

PERCENT

scales the data in units of percent of observations per data unit.

PROPORTION

scales the data in units of proportion of observations per data unit.

By default, VSCALE=PERCENT.

† WBARLINE=n

specifies the width of bar outlines when traditional graphics are produced. This option does not apply to ODS Graphics output.

WEIBULL<(Weibull-options)>

displays fitted Weibull density curves on the histogram. You can specify this option only once in a HISTOGRAM statement, but it can request any number of Weibull curves. The parameter theta must be less than the minimum data value. Use the THETA= Weibull-option to specify theta. By default, THETA=0. You can specify THETA=EST to request the maximum likelihood estimate for theta. Use the C= and SIGMA= Weibull-options to specify the shape parameter c and the scale parameter sigma. By default, the procedure computes the maximum likelihood estimates for c and sigma. Table 6 lists options you can specify with the WEIBULL option. For more information, see the section Weibull Distribution. See Example 4.22 for an example that uses the WEIBULL option.

PROC UNIVARIATE calculates the maximum likelihood estimate of sigma iteratively by using the Newton-Raphson approximation. See also the C=, SIGMA=, and THETA= Weibull-options.

† WGRID=n

specifies the line thickness for the grid when traditional graphics are produced. The option does not apply to ODS Graphics output.

ZETA= value-list
SCALE= value-list

specifies a value for the scale parameter zeta for lognormal density curves that are requested by the LOGNORMAL option. Enclose the ZETA= lognormal-option in parentheses after the LOGNORMAL option. By default, or if you specify the value EST, the procedure calculates a maximum likelihood estimate for zeta.

Last updated: April 16, 2025