Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
OUTPUT Statement

Syntax

The syntax for the OUTPUT statement is as follows:

OUTPUT <OUT=SAS-data-set> keyword=names < ... keyword=names >
PCTLPTS=percentiles PCTLPRE= prefixes <PCTLNAME=suffixes>;

You can use any number of OUTPUT statements in the CAPABILITY procedure. Each OUTPUT statement creates a new data set containing the statistics specified in that statement. When you use the OUTPUT statement, you must also use the VAR statement. In addition, the OUTPUT statement must contain at least one of the following: The components of the OUTPUT statement are described as follows.

keyword=names
specifies the statistics to include in the output data set and gives names to the new variables that contain the statistics. Specify a keyword for each desired statistic, an equal sign, and the names of the variables to contain the statistic.

In the output data set, the first variable listed after a keyword in the OUTPUT statement contains the statistic for the first variable listed in the VAR statement; the second variable contains the statistic for the second variable in the VAR statement, and so on. The list of names following the equal sign can be shorter than the list of variables in the VAR statement. In this case, the procedure uses the names in the order in which the variables are listed in the VAR statement. Consider the following example:
   proc capability noprint;
      var length width height;
      output out=summary mean=mlength mwidth;
   run;
The variables MLENGTH and MWIDTH contain the means for LENGTH and WIDTH. The mean for HEIGHT is computed by the procedure but is not saved in the output data set. See "Summary of Keywords" for tables of available keywords and the statistics they represent. Formulas for selected statistics are provided in the "Details" section.

OUT=SAS-data-set
specifies the name of the output data set. To create a permanent SAS data set, specify a two-level name. See SAS Language Reference: Dictionary for more information on permanent SAS data sets. For example, the previous statements create an output data set named SUMMARY. If the OUT= option is omitted, then by default the new data set is named using the DATAn convention.

PCTLPTS=percentiles
specifies percentiles that are not automatically computed by the procedure. The CAPABILITY procedure automatically computes the 1 st, 5 th, 10 th, 25 th, 50 th, 75 th, 90 th, 95 th, and 99 th percentiles for the data. These can be saved in an output data set using keyword=names specifications. The PCTLPTS= option generates additional percentiles and outputs them to a data set; these additional percentiles are not printed.

If you use the PCTLPTS= option, you must also use the PCTLPRE= option to provide a prefix for the new variable names. For example, to create variables that contain the 20 th, 40 th, 60 th, and 80 th percentiles of LENGTH, use the following statements:

   proc capability noprint;
      var length;
      output pctlpts=20 40 60 80 pctlpre=plen;
   run;


This creates the variables PLEN20, PLEN40, PLEN60, and PLEN80, whose values are the corresponding percentiles of LENGTH. In addition to specifying name prefixes with the PCTLPRE= option, you can also use the PCTLNAME= option to create name suffixes for the new variables created by the PCTLPTS= option.

PCTLPRE=prefixes
specifies prefixes used to create variable names for percentiles requested with the PCTLPTS= option. The PCTLPRE= and PCTLPTS= options must be used together.

The procedure generates new variable names using the prefix and the percentile values. If the specified percentile is an integer, the variable name is simply the prefix followed by the value. For noninteger percentiles, an underscore replaces the decimal point in the variable name, and decimal values are truncated to one decimal place. For example, the following statements create the variables PWID20, PWID33_3, PWID66_6, and PWID80 for the 20 th, 33.33 rd, 66.67 th, and 80 th percentiles of WIDTH, respectively:

   proc capability noprint;
      var width;
      output pctlpts=20 33.33 66.67 80 pctlpre=pwid;
   run;


If you request percentiles for more than one variable, you should list prefixes in the same order in which the variables appear in the VAR statement. If combining the prefix and percentile value results in a name longer than 8 characters, the prefix is truncated so that the variable name is 8 characters. For example, the following statements compute the 80 th and 87.5 th percentiles for LENGTH and WIDTH and save the new variables PLENGT80, PLEN87_5, PWIDTH80, and PWID87_5 in the output data set:

   proc capability noprint;
      var length width;
      output pctlpts=80 87.5 pctlpre=plength pwidth;
   run;


PCTLNAME=suffixes
provides name suffixes for the new variables created by the PCTLPTS= option. These suffixes are appended to the prefixes you specify with the PCTLPRE= option, replacing the percentile values that are used as suffixes by default. List the suffixes in the same order in which you specify the percentiles. If you specify n suffixes with the PCTLNAME= option and m percentile values with the PCTLPTS= option, where m > n, the suffixes are used to name the first n percentiles, and the default names are used for the remaining m - n percentiles. For example, consider the following statements:

   proc capability;
      var length width height;
      output pctlpts  = 20 40
             pctlpre  = pl pw ph
             pctlname = twenty;
   run;


The value TWENTY in the PCTLNAME= option is used for only the first percentile in the PCTLPTS= list. This suffix is appended to the values in the PCTLPRE= option to generate the new variable names PLTWENTY, PWTWENTY, and PHTWENTY, which contain the 20 th percentiles for LENGTH, WIDTH, and HEIGHT, respectively. Since a second PCTLNAME= suffix is not specified, variable names for the 40 th percentiles for LENGTH, WIDTH, and HEIGHT are generated using the prefixes and percentile values. Thus, the output data set contains the variables PLTWENTY, PL40, PWTWENTY, PW40, PHTWENTY, and PH40.

If combining the prefix you specify with the PCTLPRE= option and the suffix you specify with the PCTLNAME= option results in a name longer than eight characters, the prefix is truncated from the right so that the variable name is exactly eight characters. For example, the following statements add the variables PLENGMED and PWIDTMED to the output data set:
   proc capability;
      var length width;
      output pctlpts  = 50
             pctlpre  = plength pwidth
             pctlname = med;
   run;



Summary of Keywords

Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Top
Top

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