The UNIVARIATE Procedure

Example 3.1 Computing Descriptive Statistics for Multiple Variables

This example computes univariate statistics for two variables. The following statements create the data set BPressure, which contains the systolic (Systolic) and diastolic (Diastolic) blood pressure readings for 22 patients:

data BPressure;
   length PatientID $2;
   input PatientID $ Systolic Diastolic @@;
   datalines;
CK 120 50  SS 96  60 FR 100 70
CP 120 75  BL 140 90 ES 120 70
CP 165 110 JI 110 40 MC 119 66
FC 125 76  RW 133 60 KD 108 54
DS 110 50  JW 130 80 BH 120 65
JW 134 80  SB 118 76 NS 122 78
GS 122 70  AB 122 78 EC 112 62
HH 122 82
;

The following statements produce descriptive statistics and quantiles for the variables Systolic and Diastolic:

title 'Systolic and Diastolic Blood Pressure';
ods select BasicMeasures Quantiles;
proc univariate data=BPressure;
   var Systolic Diastolic;
run;

The ODS SELECT statement restricts the output, which is shown in Output 3.1.1, to the "BasicMeasures" and "Quantiles" tables; see the section ODS Table Names. You use the PROC UNIVARIATE statement to request univariate statistics for the variables listed in the VAR statement, which specifies the analysis variables and their order in the output. Formulas for computing the statistics in the "BasicMeasures" table are provided in the section Descriptive Statistics. The quantiles are calculated using Definition 5, which is the default definition; see the section Calculating Percentiles.

A sample program for this example, uniex01.sas, is available in the SAS Sample Library for Base SAS software.

Output 3.1.1: Display Basic Measures and Quantiles

Systolic and Diastolic Blood Pressure

The UNIVARIATE Procedure
Variable: Systolic

Basic Statistical Measures
LocationVariability
Mean121.2727Std Deviation14.28346
Median120.0000Variance204.01732
Mode120.0000Range69.00000
  Interquartile Range13.00000

Note: The mode displayed is the smallest of 2 modes with a count of 4.


Quantiles (Definition 5)
LevelQuantile
100% Max165
99%165
95%140
90%134
75% Q3125
50% Median120
25% Q1112
10%108
5%100
1%96
0% Min96

Systolic and Diastolic Blood Pressure

The UNIVARIATE Procedure
Variable: Diastolic

Basic Statistical Measures
LocationVariability
Mean70.09091Std Deviation15.16547
Median70.00000Variance229.99134
Mode70.00000Range70.00000
  Interquartile Range18.00000

Quantiles (Definition 5)
LevelQuantile
100% Max110
99%110
95%90
90%82
75% Q378
50% Median70
25% Q160
10%50
5%50
1%40
0% Min40


Last updated: November 06, 2022