The UNIVARIATE Procedure

Example 4.6 Analyzing a Data Set With a FREQ Variable

This example illustrates how to use PROC UNIVARIATE to analyze a data set with a variable that contains the frequency of each observation. The data set Speeding contains data on the number of cars pulled over for speeding on a stretch of highway with a 65 mile per hour speed limit. Speed is the speed at which the cars were traveling, and Number is the number of cars at each speed. The following statements create the data set:

data Speeding;
   label Speed = 'Speed (in miles per hour)';
   do Speed = 66 to 85;
      input Number @@;
      output;
   end;
   datalines;
 2  3  2  1  3  6  8  9 10 13
12 14  6  2  0  0  1  1  0  1
;

The following statements create a table of moments for the variable Speed:

title 'Analysis of Speeding Data';
ods select Moments;
proc univariate data=Speeding;
   freq Number;
   var Speed;
run;

The ODS SELECT statement restricts the output, which is shown in Output 4.6.1, to the Moments table; see the section ODS Table Names. The FREQ statement specifies that the value of the variable Number represents the frequency of each observation.

For the formulas used to compute these moments, see the section Descriptive Statistics. A sample program for this example, uniex05.sas, is available in the SAS Sample Library for Base SAS software.

Output 4.6.1: Table of Moments

Analysis of Speeding Data

The UNIVARIATE Procedure
Variable: Speed (Speed (in miles per hour))
 
Freq: Number

Moments
N 94 Sum Weights 94
Mean 74.3404255 Sum Observations 6988
Std Deviation 3.44403237 Variance 11.861359
Skewness -0.1275543 Kurtosis 0.92002287
Uncorrected SS 520594 Corrected SS 1103.10638
Coeff Variation 4.63278538 Std Error Mean 0.35522482