This example, which uses the data set BPressure
introduced in Example 4.1, illustrates how to produce a table of the extreme observations and a table of the extreme values in a data set. The following
statements generate the "Extreme Observations" tables for Systolic
and Diastolic
, which enable you to identify the extreme observations for each variable:
title 'Extreme Blood Pressure Observations'; ods select ExtremeObs; proc univariate data=BPressure; var Systolic Diastolic; id PatientID; run;
The ODS SELECT statement restricts the output to the "ExtremeObs" table; see the section ODS Table Names. The ID statement requests that the extreme observations are to be identified using the value of PatientID
as well as the observation number. By default, the five lowest and five highest observations are displayed. You can use the
NEXTROBS= option to request a different number of extreme observations.
Output 4.3.1 shows that the patient identified as 'CP' (Observation 7) has the highest values for both Systolic
and Diastolic
. To visualize extreme observations, you can create histograms; see Example 4.14.
The following statements generate the "Extreme Values" tables for Systolic
and Diastolic
, which tabulate the tails of the distributions:
title 'Extreme Blood Pressure Values'; ods select ExtremeValues; proc univariate data=BPressure nextrval=5; var Systolic Diastolic; run;
The ODS SELECT statement restricts the output to the "ExtremeValues" table; see the section ODS Table Names. The NEXTRVAL= option specifies the number of extreme values at each end of the distribution to be shown in the tables in Output 4.3.2.
Output 4.3.2 shows that the values 78 and 80 occurred twice for Diastolic
and the maximum of Diastolic
is 110. Note that Output 4.3.1 displays the value of 80 twice for Diastolic
because there are two observations with that value. In Output 4.3.2, the value 80 is only displayed once.
A sample program for this example, uniex01.sas, is available in the SAS Sample Library for Base SAS software.