Study guide
8.4 Screening Extreme & Missing Values with PROC UNIVARIATE
SAS Certified Specialist: Base Programming Using SAS 9.4 A00-231
Track your progress as you read
Finished sections get a check mark.
1 Chapter 1: SAS Base Programming Exam Overview
1.1 A00-231 Exam Format, Scoring & Test-Day Logistics 1.2 Official Content Areas, Weights & Study Plan
2 Chapter 2: Accessing & Creating SAS Data Structures
2.1 SAS Environment, Syntax Rules, & Data Step Basics 2.2 SAS Data Libraries & the LIBNAME Statement 2.3 Investigating Libraries with PROC CONTENTS & PROC DATASETS 2.4 Importing Delimited & Excel Data with PROC IMPORT 2.5 Raw Data Ingestion with INFILE and INPUT Statements
3 Chapter 3: Managing & Combining SAS Data Sets
3.1 Reading SAS Data Sets with the SET Statement 3.2 Combining Data Sets: Concatenating & Interleaving 3.3 Match-Merging with BY Statements & FIRST./LAST. Processing 3.4 Controlling Data Output & Variable Selection (KEEP, DROP, RENAME, OBS=)
4 Chapter 4: Data Transformation & Conditional Logic
4.1 Creating & Modifying Variables with Assignment Statements 4.2 Modifying Variable Attributes with LENGTH, LABEL, FORMAT & RENAME= 4.3 Conditional Processing: IF-THEN/ELSE Statements & WHERE Subsetting 4.4 Accumulating Totals & Subtotals (RETAIN & Sum Statement) 4.5 Processing Data Iteratively with DO Loops
5 Chapter 5: SAS Functions & Data Type Conversions
5.1 Character Functions for String Manipulation 5.2 Numeric & Mathematical Functions 5.3 Working with SAS Dates, Times, & Intervals 5.4 Reading & Displaying Dates with Informats and Formats 5.5 Explicit & Implicit Data Type Conversions (INPUT & PUT)
6 Chapter 6: Restructuring Data & Program Maintenance
6.1 SAS Array Processing for Multi-Variable Transformations 6.2 Sorting Data Sets with PROC SORT 6.3 Restructuring Data Sets with PROC TRANSPOSE 6.4 Creating & Applying Custom Formats with PROC FORMAT 6.5 Simplifying Programs with Macro Variables (%LET)
7 Chapter 7: Error Handling & Debugging SAS Programs
7.1 SAS Log Analysis & Diagnostic Messages 7.2 Syntax vs. Logic Errors & Phasing 7.3 Debugging Techniques with _ERROR_, _N_, & PUT Statements 7.4 Identifying Logic Errors with the PUTLOG Statement 7.5 Handling Missing Values & Preventing Calculation Propagations
8 Chapter 8: Summary & Detail Data Reporting
8.1 Detail Reporting with PROC PRINT 8.2 Descriptive Statistics with PROC MEANS & PROC SUMMARY 8.3 Frequency & Categorical Analysis with PROC FREQ 8.4 Screening Extreme & Missing Values with PROC UNIVARIATE 8.5 Custom Tabular Reports with PROC REPORT & PROC TABULATE
9 Chapter 9: ODS Output Delivery & Data Export
9.1 Output Delivery System (ODS) Architecture Basics 9.2 Generating PDF, HTML, & RTF Output Destinations 9.3 Exporting Reports to Excel with ODS EXCEL & XLSX 9.4 Generating CSV, PowerPoint & Other ODS Destinations 9.5 Customizing ODS Titles, Footnotes, & Global Options 9.6 Exporting SAS Data Sets with PROC EXPORT & the XLSX Engine
8.4 Screening Extreme & Missing Values with PROC UNIVARIATE
Key Takeaways Explain This Topic AI
The A00-231 content guide names PROC UNIVARIATE specifically for identifying extreme and missing values in a data set.
Default output comprises five tables: Moments, Basic Statistical Measures, Tests for Location, Quantiles, and Extreme Observations.
The Extreme Observations table lists the five lowest and five highest values with their observation numbers, and NEXTROBS=n changes that count.
The Moments table reports N alongside N Miss, giving the missing-value count for each analysis variable without a separate step.
The ID statement replaces observation numbers in the Extreme Observations table with a meaningful key such as a customer or patient identifier.
Last updated: August 2026
8.4 Screening Extreme & Missing Values with PROC UNIVARIATE
Quick Answer: The content guide's summary-reporting objective ends with a bullet that names one procedure by name: "Identify extreme and missing values with the UNIVARIATE procedure." PROC UNIVARIATE produces a far richer distributional profile than PROC MEANS , and its Extreme Observations table — the five lowest and five highest values with their observation numbers — is the feature the exam is pointing at.
- 1. The Simplest Invocation proc univariate data=sashelp.class;
- var Height Weight;
- run;
For each analysis variable, SAS prints five tables :
- Table What it reports
- Moments N , N Miss , Mean, Sum, Std Deviation, Variance, Skewness, Kurtosis, and sums of squares
- Basic Statistical Measures Mean, Median, Mode; Std Deviation, Variance, Range, Interquartile Range
- Tests for Location Student's t, Sign, and Signed Rank tests of whether the mean or median differs from zero
- Quantiles 100% Max, 99%, 95%, 90%, 75% Q3, 50% Median, 25% Q1, 10%, 5%, 1%, 0% Min
- Extreme Observations The five lowest and five highest values with their observation numbers
That last table is the reason the procedure exists for this objective. PROC MEANS tells you the minimum is -999 ; PROC UNIVARIATE tells you the minimum is -999 , that it occurs at observation 412, and that the next four smallest values are 50 , 51 , 52 , and 53 — which immediately identifies -999 as a sentinel code rather than a real measurement.
2. Reading the Extreme Observations Table Extreme Observations
-----Lowest----- -----Highest----
Value Obs Value Obs
- 999 412 78 19
- 50 88 79 3
- 51 205 80 11
- 52 17 81 15
- 53 94 999 377
Two sentinel values ( -999 and 999 ) stand out instantly against a body of plausible heights, and the Obs column tells you exactly which rows to inspect.
- Controlling How Many Extremes Appear /* Show the 10 lowest and 10 highest instead of the default 5 */
- proc univariate data=work.patients nextrobs=10;
- var SystolicBP;
- run;
NEXTROBS=n sets the number of extreme observations listed. A closely related option, NEXTRVAL=n , prints the n extreme values without observation numbers.
Making the Listing Meaningful with ID
Observation numbers are useless once a data set has been sorted or subset. The ID statement replaces them with a real key. proc univariate data=work.patients nextrobs=10;
- var SystolicBP;
- id PatientID;
- run;
The Extreme Observations table now shows PatientID beside each value, so the outlier can be traced back to a record rather than a row position.
- 3. Counting Missing Values
- The Moments table reports N and N Miss side by side: Moments
- N 185 Sum Weights 185
- Mean 62.336757 Sum Observations 11532.3
- Std Deviation 5.1270985 Variance 26.287139
- N Miss 15
N is the count of non-missing values used in every statistic; N Miss is the count of missing values excluded from them. For a variable meant to be fully populated, a non-zero N Miss is an immediate data-quality finding — and you get it without writing a separate PROC MEANS ... NMISS or PROC FREQ ... MISSING step.
Exam Trap: every statistic in PROC UNIVARIATE — like every statistic in PROC MEANS — is computed on non-missing values only. A mean of 62.3 over N = 185 says nothing about the 15 missing rows. N Miss is what
quantifies the gap.
- 4. Subgroup Screening with CLASS and BY /* One profile per treatment group, no pre-sorting required */
- proc univariate data=work.trial;
- class Treatment;
- var Response;
- id SubjectID;
- run;
- /* BY requires the data to be sorted first */
- proc sort data=work.trial out=work.trial_sorted;
- by Site;
- run;
- proc univariate data=work.trial_sorted;
- by Site;
- var Response;
- run;
As in PROC MEANS , CLASS handles unsorted data while BY requires a prior PROC SORT . Screening by subgroup often reveals that an "outlier" is perfectly normal within its own stratum.
5. Trimming the Output
The full five-table report is heavy when you only want the extremes. Two mechanisms cut it down: /* Statement-level: keep only the extremes and the moments */
ods select ExtremeObs Moments;
- proc univariate data=work.patients nextrobs=10;
- var SystolicBP;
- id PatientID;
- run;
ods select all; /* restore default behaviour */ /* Capture the extremes into a data set for programmatic follow-up */
ods output ExtremeObs = work.outliers;
- proc univariate data=work.patients nextrobs=10;
- var SystolicBP;
- run;
The NOPRINT option suppresses all printed output, which is appropriate when the goal is purely to build an output data set.
6. UNIVARIATE versus MEANS
- Question Procedure
- What is the mean, sum, or standard deviation by group? PROC MEANS
- Which specific rows hold the highest and lowest values? PROC UNIVARIATE
- How many values are missing? Either ( NMISS in MEANS , N Miss in MEANS and UNIVARIATE )
- Is the distribution skewed, and where do the quartiles fall? PROC UNIVARIATE
- I need a compact summary table for a report PROC MEANS
- I need to screen a new data set for bad values before trusting it PROC UNIVARIATE
The one-line rule: PROC MEANS summarizes the data you believe in; PROC UNIVARIATE tells you whether you should.