Chapter Contents

Previous

Next
The CORR Procedure

Example 2: Computing Rectangular Correlation Statistics with Missing Data


Procedure features:
PROC CORR statement options:
COV
NOSIMPLE
SSCP
VAR statement
WITH statement

This example


Program

options nodate pageno=1 linesize=80 pagesize=60;
 Note about code
data setosa;
   input SepalLength SepalWidth PetalLength PetalWidth @@;
   label sepallength='Sepal Length in mm.'
         sepalwidth='Sepal Width in mm.'
         petallength='Petal Length in mm.'
         petalwidth='Petal Width in mm.';
   datalines;
50 33 14 02   46 34 14 03   46 36 .  02
51 33 17 05   55 35 13 02   48 31 16 02
52 34 14 02   49 36 14 01   44 32 13 02
50 35 16 06   44 30 13 02   47 32 16 02
48 30 14 03   51 38 16 02   48 34 19 02
50 30 16 02   50 32 12 02   43 30 11 .
58 40 12 02   51 38 19 04   49 30 14 02
51 35 14 02   50 34 16 04   46 32 14 02
57 44 15 04   50 36 14 02   54 34 15 04
52 41 15 .    55 42 14 02   49 31 15 02
54 39 17 04   50 34 15 02   44 29 14 02
47 32 13 02   46 31 15 02   51 34 15 02
50 35 13 03   49 31 15 01   54 37 15 02
54 39 13 04   51 35 14 03   48 34 16 02
48 30 14 01   45 23 13 03   57 38 17 03
51 38 15 03   54 34 17 02   51 37 15 04
52 35 15 02   53 37 15 02
;
 Note about code
proc corr data=setosa sscp cov nosimple;
 Note about code
   var sepallength sepalwidth;
   with petallength petalwidth;
 Note about code
   title 'Fisher (1936) Iris Setosa Data';
run;


Output
The correlation report includes rectangular sum-of-squares and crossproducts, covariances, and the correlation matrix using the two WITH variables and two VAR variables. The descriptive statistics do not appear. PROC CORR uses variable labels to label matrix rows (WITH variables).

PROC CORR calculates sum-of-squares and crossproducts and covariances statistics for each pair of variables by using observations with nonmissing row and column variable values.

Because missing data are excluded pairwise, the number of observations PROC CORR uses to calculate the correlation coefficients changes.

[HTML Output]
 [Listing Output]


Chapter Contents

Previous

Next

Top of Page

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