UNIVAR
variable <(v-options)> <…variable <(v-options)>> </ options> ;
The UNIVAR statement computes univariate kernel density estimates. You can specify various v-options for each variable by enclosing them in parentheses after the variable name. You can also specify global options among the UNIVAR statement options following a slash (/). Global options apply to all the variables specified in the UNIVAR statement. However, individual variable v-options override the global options.
Note: The VAR statement supported by PROC KDE in SAS 8 and earlier releases is now obsolete. The VAR statement has been replaced by the UNIVAR and BIVAR statements, which enable you to produce multiple kernel density estimates with a single invocation of the procedure.
Table 52.2 summarizes the options available in the UNIVAR statement.
Table 52.2: UNIVAR Statement Options
Option |
Description |
---|---|
Specifies a bandwidth multiplier |
|
Specifies a lower grid limit |
|
Specifies an upper grid limit |
|
Specifies the method used to compute the bandwidth |
|
Specifies a number of grid points |
|
Suppresses output tables produced |
|
Specifies the output SAS data set containing the kernel density estimate |
|
Requests that a table of percentiles |
|
Requests plots of the univariate kernel density estimate |
|
Specifies the maximum grid value in determining the Sheather-Jones plug-in bandwidth |
|
Specifies the minimum grid value in determining the Sheather-Jones plug-in bandwidth |
|
Specifies the number of grid values used in determining the Sheather-Jones plug-in bandwidth |
|
Specifies the tolerance for termination of the bisection algorithm |
|
Produces a table for each variable containing standard univariate statistics and the bandwidth |
You can specify the following options in the UNIVAR statement. As noted, some options can be used as v-options.
Suppose you have the variables x1
, x2
, x3
, and x4
in the SAS data set MyData
. You can request a univariate kernel density estimate for each of these variables with the following statements:
proc kde data=MyData; univar x1 x2 x3 x4; run;
You can also specify different bandwidths and other options for each variable. For example, the following statements request kernel density estimates that use Silverman’s rule of thumb (SROT) method for all variables:
proc kde data=MyData; univar x1 (bwm=2) x2 (bwm=0.5 ngrid=100) x3 x4 / ngrid=200 method=srot; run;
The option NGRID=200 applies to the variables x1
, x3
, and x4
, but the v-option NGRID=100 is applied to x2
. Bandwidth multipliers of 2 and 0.5 are specified for the variables x1
and x2
, respectively.