[See CAPOUT1 in the SAS/QC Sample Library]An automobile manufacturer producing seat belts saves summary information in an output data set with the CAPABILITY procedure. The following statements create the data set Belts, which contains the breaking strengths (Strength) and widths (Width) of a sample of 50 belts:
data Belts; label Strength = 'Breaking Strength (lb/in)' Width = 'Width in Inches'; input Strength Width @@; datalines; 1243.51 3.036 1221.95 2.995 1131.67 2.983 1129.70 3.019 1198.08 3.106 1273.31 2.947 1250.24 3.018 1225.47 2.980 1126.78 2.965 1174.62 3.033 1250.79 2.941 1216.75 3.037 1285.30 2.893 1214.14 3.035 1270.24 2.957 1249.55 2.958 1166.02 3.067 1278.85 3.037 1280.74 2.984 1201.96 3.002 1101.73 2.961 1165.79 3.075 1186.19 3.058 1124.46 2.929 1213.62 2.984 1213.93 3.029 1289.59 2.956 1208.27 3.029 1247.48 3.027 1284.34 3.073 1209.09 3.004 1146.78 3.061 1224.03 2.915 1200.43 2.974 1183.42 3.033 1195.66 2.995 1258.31 2.958 1136.05 3.022 1177.44 3.090 1246.13 3.022 1183.67 3.045 1206.50 3.024 1195.69 3.005 1223.49 2.971 1147.47 2.944 1171.76 3.005 1207.28 3.065 1131.33 2.984 1215.92 3.003 1202.17 3.058 ;
The following statements produce two output data sets containing summary statistics:
proc capability data=Belts; var Strength Width; output out=Means mean=smean wmean; output out=Strstats mean=smean std=sstd min=smin max=smax; run;
proc print data=Means; run;
proc print data=Strstats; run;
Note that if you specify an OUTPUT statement, you must also specify a VAR statement. You can use multiple OUTPUT statements with a single procedure statement. Each OUTPUT statement creates a new data set. The OUT= option specifies the name of the output data set. In this case, two data sets, Means and Strstats, are created. See Figure 5.27 for a listing of Means and Figure 5.28 for a listing of Strstats.
Summary statistics are saved in an output data set by specifying keyword=names after the OUT= option. In the preceding statements, the first OUTPUT statement specifies the keyword MEAN followed by the names smean and wmean. The second OUTPUT statement specifies the keywords MEAN, STD, MIN, and MAX, for which the names smean, sstd, smin, and smax are given.
The keyword specifies the statistic to be saved in the output data set, and the names determine the names for the new variables. The first name listed after a keyword contains that statistic for the first variable listed in the VAR statement; the second name contains that statistic for the second variable in the VAR statement, and so on.
Thus, the data set Means contains the mean of Strength in a variable named smean and the mean of Width in a variable named wmean. The data set Strstats contains the mean, standard deviation, minimum value, and maximum value of Strength in the variables smean, sstd, smin, and smax, respectively.
Statistical Intervals for Fluid Weight |
Obs | smean | wmean |
---|---|---|
1 | 1205.75 | 3.00584 |
Statistical Intervals for Fluid Weight |
Obs | smean | sstd | smax | smin |
---|---|---|---|---|
1 | 1205.75 | 48.3290 | 1289.59 | 1101.73 |