The UNIVARIATE Procedure |
This example illustrates how to add insets with descriptive statistics to a comparative histogram; see Output 4.17.1. Three similar machines are used to attach a part to an assembly. One hundred assemblies are sampled from the output of each machine, and a part position is measured in millimeters. The following statements create the data set Machines, which contains the measurements in a variable named Position:
data Machines; input Position @@; label Position = 'Position in Millimeters'; if (_n_ <= 100) then Machine = 'Machine 1'; else if (_n_ <= 200) then Machine = 'Machine 2'; else Machine = 'Machine 3'; datalines; -0.17 -0.19 -0.24 -0.24 -0.12 0.07 -0.61 0.22 1.91 -0.08 -0.59 0.05 -0.38 0.82 -0.14 0.32 0.12 -0.02 0.26 0.19 ... more lines ... 0.79 0.66 0.22 0.71 0.53 0.57 0.90 0.48 1.17 1.03 ; run;
The following statements create the comparative histogram in Output 4.17.1:
title 'Machine Comparison Study'; proc univariate data=Machines noprint; class Machine; histogram Position / nrows = 3 intertile = 1 midpoints = -1.2 to 2.2 by 0.1 vaxis = 0 to 16 by 4; inset mean std="Std Dev" / pos = ne format = 6.3; run;
The INSET statement requests insets that contain the sample mean and standard deviation for each machine in the corresponding tile. The MIDPOINTS= option specifies the midpoints of the histogram bins.
Output 4.17.1 shows that the average position for Machines 2 and 3 are similar and that the spread for Machine 1 is much larger than for Machines 2 and 3.
A sample program for this example, uniex11.sas, is available in the SAS Sample Library for Base SAS software.
Copyright © SAS Institute, Inc. All Rights Reserved.