PROC TTEST <options>;
The PROC TTEST statement invokes the TTEST procedure. Table 2 summarizes the options available in the PROC TTEST statement. The options are then described fully in alphabetical order.
Table 2: PROC TTEST Statement Options
| Option | Description |
|---|---|
| Basic Options | |
| DATA= | Specifies input data set |
| ORDER= | Determines sort order of CLASS variable or CROSSOVER= treatment variables |
| Analysis Options | |
| ALPHA= | Specifies 1 – confidence level |
| DIST= | Specifies distributional assumption (normal or lognormal) |
| H0= | Specifies null value |
| SIDES= | Specifies number of sides and direction |
| TEST= | Specifies test criterion (difference or ratio) |
| TOST | Requests equivalence test and specifies bounds |
| Displayed Output | |
| CI= | Requests confidence interval for standard deviation or coefficient of variation |
| COCHRAN | Requests Cochran t test |
| PLOTS | Produces ODS statistical graphics |
| Output Ordering | |
| BYVAR | Groups results by variables that are specified in the PAIRED or VAR statement |
| NOBYVAR | Groups results by tables |
You can specify the following options:
specifies that confidence intervals (except test-based mean confidence intervals when you specify the TOST option) are to be 100(1 – p)% confidence intervals, where 0 < p < 1. When you specify the TOST option, the test-based mean confidence intervals are 100(1 – 2p)% confidence intervals. For the PLOTS=BOOTSTRAP(CORRELATION) option, the ALPHA= option specifies that the elliptical prediction region is to be a 100(1 – p)% prediction region. If p is 0 or less, or 1 or more, an error message is printed. By default, ALPHA=0.05.
groups the results by the variables that are specified in the PAIRED or VAR statement. The BYVAR option is enabled by default. Note that this represents a change from previous releases for how the results are grouped with respect to variables and tables. Prior to SAS 9.2, multiple variables were included in each table, similar to the new NOBYVAR option.
specifies whether a confidence interval is displayed for and, if so, what kind. You can specify one or more of the following values:
The values EQUAL and UMPU together request that both types of confidence intervals be displayed. If the value NONE is specified with one or both of the values EQUAL and UMPU, NONE takes precedence. For more information, see the section Two-Independent-Sample Design. By default, CI=EQUAL.
requests the Cochran and Cox (1950) approximation of the probability level for the unequal variances situation. For more information, see the section Two-Independent-Sample Design.
names the SAS data set for the procedure to use. By default, PROC TTEST uses the most recently created SAS data set. The input data set can contain summary statistics of the observations instead of the observations themselves. The number, mean, and standard deviation of the observations are required for each BY group (one sample and paired differences) or for each class within each BY group (two samples). For more information about the DATA= option, see the section Input Data Set of Statistics.
specifies the underlying distribution assumed for the data. You can specify the following values:
specifies that the underlying distribution is lognormal.
specifies that the underlying distribution is normal.
By default, DIST=NORMAL, unless TEST=RATIO is specified, in which case the default is DIST=LOGNORMAL.
requests tests against a null value of m, unless the TOST option is used, in which case m is merely used to derive the lower and upper equivalence bounds. For the crossover design, the value m applies for both treatment and period tests. By default, H0=0 when TEST=DIFF (or DIST=NORMAL for a one-sample design) and H0=1 when TEST=RATIO (or DIST=LOGNORMAL for a one-sample design).
includes all variables that are specified in the PAIRED or VAR statement together in each output table. If the NOBYVAR option is not specified, then the BYVAR option is enabled, grouping the results by the PAIRED and VAR variables.
specifies the order in which to sort the levels of the classification variables (which are specified in the CLASS statement) and treatment variables (which are specified in the CROSSOVER= option in the VAR statement).
This option applies to the levels for all classification or treatment variables, except when you use the ORDER=FORMATTED option with numeric classification or treatment variables that have no explicit format. With this option, the levels of such variables are ordered by their internal value.
You can specify the following values:
Table 3: continued
| Value of ORDER= | Levels Sorted By |
|---|---|
| DATA | Order of appearance in the input data set. |
| FORMATTED | External formatted value, except for numeric variables that have no explicit format, which are sorted by their unformatted (internal) value. The sort order is machine-dependent. |
| FREQ | Descending frequency count; levels that have the greatest number of observations come first in the order. In the event of a tie, ORDER=MIXED is used. |
| INTERNAL | Unformatted value. The sort order is machine-dependent. |
| MIXED | Same as ORDER=FORMATTED if the unformatted variable is character-valued; same as ORDER=INTERNAL otherwise (the unformatted variable is numeric-valued). |
For FORMATTED and INTERNAL, the sort order is machine-dependent.
For more information about sort order, see the chapter on the SORT procedure in the Base SAS Procedures Guide and the discussion of BY-group processing in the "Grouping Data" section of SAS Programmers Guide: Essentials.
By default, ORDER=MIXED, which corresponds to the ordering in releases previous to SAS 9.2.
controls the plots produced through ODS Graphics. When you specify only one plot-request, you can omit the parentheses around the plot-request. Here are some examples:
plots=none
plots=(histogram boxplot interval qq profiles agreement)
plots(unpack)=summary
plots(showh0)=interval(type=pergroup)
plots=(summary(unpack) interval(type=period))
ODS Graphics must be enabled before plots can be requested. For example:
ods graphics on;
proc ttest plots=all;
var oxygen;
run;
ods graphics off;
For more information about enabling and disabling ODS Graphics, see the section Enabling and Disabling ODS Graphics in Chapter 24, Statistical Graphics Using ODS.
If ODS Graphics is enabled but you do not specify the PLOTS option, then PROC TTEST produces a default set of plots. ( Note: The graphical results are unavailable if your input data set contains summary statistics rather than observation values.)
For a one-sample design, the default plots are the following:
summary plot (histogram with overlaid normal and kernel densities, box plot, and confidence interval band) for the input data set
Q-Q plot for the input data set
summary plot of bootstrap statistics, if you specify the BOOTSTRAP statement
Q-Q plot of bootstrap statistics, if you specify the BOOTSTRAP statement
correlation plot of bootstrap statistics, if you specify the BOOTSTRAP statement
For a two-independent-sample design, the default plots are the following:
summary plot (comparative histograms with overlaid densities and box plots) for the input data set
Q-Q plot for the input data set
summary plot of bootstrap statistics, if you specify the BOOTSTRAP statement
Q-Q plot of bootstrap statistics, if you specify the BOOTSTRAP statement
correlation plot of bootstrap statistics, if you specify the BOOTSTRAP statement
For a paired design, the default plots are the following:
summary plot (histogram, densities, box plot, and confidence interval) of the difference or ratio for the input data set
Q-Q plot of the difference or ratio for the input data set
profiles plot for the input data set
agreement plot for the input data set
summary plot of bootstrap statistics, if you specify the BOOTSTRAP statement
Q-Q plot of bootstrap statistics, if you specify the BOOTSTRAP statement
correlation plot of bootstrap statistics, if you specify the BOOTSTRAP statement
For a crossover design, the default plots are the following:
comparative histograms with overlaid densities by treatment and period for the input data set
comparative box plots by treatment and period for the input data set
Q-Q plots by treatment and period for the input data set
profiles over treatment plot for the input data set
agreement of treatments plot for the input data set
For more detailed descriptions of plots, see the section Interpreting Graphs.
You can specify the following global-plot-options:
suppresses the default plots. Only plots that you specifically request are displayed.
shows the null value (as specified by the H0= option in the PROC TTEST statement) in all relevant plots. For one-sample and paired designs, the null value can appear when you also specify the SUMMARY, BOOTSTRAP(SUMMARY), BOOTSTRAP(BOX), BOOTSTRAP(INTERVAL), BOX, or INTERVAL plot-request. For two-independent-sample designs and crossover designs, the null value can appear when you specify the BOOTSTRAP(INTERVAL) or INTERVAL plot-request. For crossover designs, the null value can appear only when you specify the INTERVAL plot-request.
suppresses paneling. By default, multiple plots can appear in some output panels. Specify this option to get each plot in a separate panel. You can specify PLOTS(UNPACKPANEL) to unpack the default plots.
You can specify the following plot-requests:
produces all appropriate plots. You can specify other plot-requests with ALL; for example, to request all plots and specify that intervals should be for the period difference in a crossover design, specify PLOTS=(ALL INTERVAL(TYPE=PERIOD)).
produces an agreement plot for the input data set. This plot is produced by default for paired and crossover designs, the only designs for which this option is valid.
For paired designs, the second response in each pair is plotted against the first response. For more information, see the section Agreement Plots for Paired Designs.
For crossover designs, you can specify the following options:
plots the response in the second period against the response in the first period. For more information, see the section Period Agreement Plots for Crossover Designs.
plots the response associated with the second treatment against the response associated with the first treatment. For more information, see the section Treatment Agreement Plots for Crossover Designs.
By default, TYPE=TREATMENT for crossover designs.
controls the bootstrap-related plots that are produced through ODS Graphics.
You can specify the following bootstrap-plot-requests:
produces box plots of bootstrap mean and standard deviation.
A bootstrap confidence interval is shown as a band in the background if the specified value of the BOOTCI= option in the BOOTSTRAP statement is capable of producing confidence intervals for the bootstrap statistic.
For more information, see the section Box Plots.
produces a scatter plot of bootstrap standard deviation versus mean statistics with an overlaid elliptical prediction region.
This correlation plot is produced by default for one-sample, two-sample, and paired designs if you specify the BOOTSTRAP statement.
For more information, see the section Bootstrap Correlation Plots.
produces histograms along with overlaid normal and kernel densities for bootstrap mean and standard deviation.
For more information, see the section Histograms.
produces plots of bootstrap confidence intervals for the mean and standard deviation.
For more information, see the section Confidence Intervals.
produces normal quantile-quantile (Q-Q) plots of the bootstrap mean and standard deviation. These plots are produced by default for one-sample, two-sample, and paired designs if you specify the BOOTSTRAP statement.
For more information, see the section Q-Q Plots.
produces bootstrap histogram and box plots together in a single panel, where the plots share common X axes. These plots are produced by default for one-sample, paired, and two-independent-sample designs if you specify the BOOTSTRAP statement. For more information, see the documentation for BOX and HISTOGRAM bootstrap-plot-requests. You can specify the following option:
plots bootstrap histograms along with overlaid densities in one panel and bootstrap box plots (along with confidence interval bands, if applicable) in another panel. Note that specifying PLOTS(ONLY)=BOOTSTRAP(SUMMARY(UNPACK)) is exactly the same as specifying PLOTS(ONLY)=BOOTSTRAP(BOX HISTOGRAM).
By default, if you specify the BOOTSTRAP statement, then the SUMMARY, QQ, and CORRELATION bootstrap-plot-requests are included unless you exclude them by specifying the ONLY global-plot-option.
The BOOTSTRAP plot-request is ignored if you omit the BOOTSTRAP statement.
produces a box plot or comparative box plots for the input data set. A box plot is produced by default for crossover designs. For other designs, a box plot appears by default if you specify the SUMMARY or ALL plot-request.
For one-sample and paired designs, a confidence interval for the mean is shown as a band in the background, along with the equivalence bounds if the TOST option is used in the PROC TTEST statement.
For a two-independent-sample design, comparative box plots (one for each class) are shown. For a crossover design, comparative box plots for all four combinations of the two treatments and two periods are shown.
For more information, see the section Box Plots.
produces a histogram or comparative histograms along with overlaid normal and kernel densities for the input data set. A histogram is produced by default for crossover designs. For other designs, it appears by default if you specify the SUMMARY or ALL plot-request.
For one-sample and paired designs, the histogram and densities are based on the test criterion (which is the mean difference or ratio for a paired design). For a two-independent-sample design, comparative histograms (one for each class) are shown. For a crossover design, histograms for all four combinations of the two treatments and two periods are shown.
For more information, see the section Histograms.
produces plots of confidence interval for means of the input data set.
For a two-independent-sample design, you can specify one of the following options:
shows two separate two-sided confidence intervals, one for each class. You cannot use this option along with the SHOWH0 global-plot-option.
shows pooled and Satterthwaite confidence intervals.
By default, TYPE=TEST for two-independent-sample designs.
For a crossover design, you can specify the following options:
shows four separate two-sided intervals, one for each treatment-by-period combination. You cannot use this option along with the SHOWH0 global-plot-option.
shows pooled and Satterthwaite confidence intervals for the period difference or ratio. This option is invalid if you specify the IGNOREPERIOD option in the VAR statement.
shows pooled and Satterthwaite confidence intervals for the treatment difference or ratio.
By default, TYPE=TREATMENT for crossover designs.
For more information, see the section Confidence Intervals.
suppresses all plots.
produces a profiles plot for the input data set. This plot is produced by default for paired and crossover designs, the only designs for which this option is valid.
For paired designs, a line is drawn for each observation from left to right connecting the first response to the second response. For more information, see the section Profiles for Paired Designs.
For crossover designs, you can specify one of the following options:
shows response profiles over period, connecting the first period on the left to the second period on the right for each subject. For more information, see the section Profiles over Period for Crossover Designs.
shows response profiles over treatment values, connecting the first treatment on the left to the second treatment on the right for each observation. For more information, see the section Profiles over Treatment for Crossover Designs.
By default, TYPE=TREATMENT for crossover designs.
produces a normal quantile-quantile (Q-Q) plot for the input data set. This plot is produced by default for all designs.
For two-sample designs, separate plots are shown for each class in a single panel. For crossover design, separate plots are shown for each treatment-by-period combination in a single panel.
For more information, see the section Q-Q Plots.
produces histogram and box plots for the input data set together in a single panel, where the plots share common X axes. These plots are produced by default for one-sample, paired, and two-independent-sample designs, the only designs for which this option is valid. For more information, see the documentation for the BOX and HISTOGRAM plot-requests. You can specify the following option:
specifies the number of sides (or tails) and direction of the statistical tests and test-based confidence intervals. The values are interpreted as follows:
specifies two-sided tests and confidence intervals.
specifies lower one-sided tests (in which the alternative hypothesis indicates a parameter value less than the null value) and lower one-sided confidence intervals between minus infinity and the upper confidence limit.
specifies upper one-sided tests (in which the alternative hypothesis indicates a parameter value greater than the null value) and upper one-sided confidence intervals between the lower confidence limit and infinity.
By default, SIDES=2.
specifies the test criterion. This option is ignored for one-sample designs. You can specify the following values:
tests the difference of means.
tests the ratio of means.
By default, TEST=DIFF, unless you specify DIST=LOGNORMAL, in which case the default is TEST=RATIO.
performs Schuirmann’s TOST equivalence test. The upper equivalence bound must be specified. If TEST=DIFF, then the default value for the lower equivalence bound is upper, where m is the value of the H0= option. If TEST=RATIO, then the default value for lower is m / upper.