Chapter Contents

Previous

Next
The UNIVARIATE Procedure

Example 1: Univariate Analysis for Multiple Variables


Procedure features:
VAR statement

This example computes the univariate statistics for two variables.


Program

options nodate pageno=1 linesize=80 pagesize=72;
 Note about code
data statepop;
   input State $ citypop_80 citypop_90 
         Noncitypop_80 Noncitypop_90 Region @@;
   label citypop_80='1980 metropolitan pop in millions'
         noncitypop_80='1980 nonmetropolitan pop in millions'
         citypop_90='1990 metropolitan pop in millions'
         noncitypop_90='1990 nonmetropolitan pop in million'
         region='Geographic region';
    datalines;
ME   .405   .443  .721  .785 1   NH  .535   .659  .386  .450  1
NY 16.144 16.515 1.414 1.475 1   NJ 7.365  7.730   .A    .A   1
PA 10.067 10.083 1.798 1.799 1   DE  .496   .553  .098  .113  2
       ...more lines of data...
IA  1.198  1.200 1.716 1.577 3   MO 3.314  3.491 1.603 1.626 3
MT   .189   .191  .598  .608 4   ID  .257   .296  .687  .711 4
HI   .763   .836  2.02  .272 4
;
 Note about code
proc univariate data=statepop;
   var citypop_90 citypop_80;
 Note about code
   title 'United States Census of Population and Housing';
run;


Output
Univariate statistics for both analysis variables appear on separate pages. Because each population value is unique, the mode is missing.

By comparing the two sums in the Moments table, you find that the metropolitan population increased by 20 million (197.7 - 176.9) in ten years. By comparing the two medians in Basic Statistical Measures table or the Quantiles table, you find that the 1990 median metropolitan population increased to 2.423 million.

[HTML Output]
 [Listing Output]


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.