The following statements compute Pearson correlations:
title 'Correlations for a Fitness and Exercise Study'; proc corr data=Fitness nomiss outp=CorrOutp; var weight oxygen runtime; run;
The NOMISS option excludes observations with missing values of the VAR statement variables from the analysis—that is, the
same set of 28 observations is used to compute the correlation for each pair of variables. The OUTP= option creates an output
data set named CorrOutp
that contains the Pearson correlation statistics.
"Pearson Correlation Coefficients" table in Output 2.7.1 displays the correlation and the p-value under the null hypothesis of zero correlation.
The following statements display (in Output 2.7.2) the output data set:
title 'Output Data Set from PROC CORR'; proc print data=CorrOutp noobs; run;
The output data set has the default type CORR and can be used as an input data set for regression or other statistical procedures.
For example, the following statements request a regression analysis using CorrOutp
, without reading the original data in the REG procedure:
title 'Input Type CORR Data Set from PROC REG'; proc reg data=CorrOutp; model runtime= weight oxygen; run;
The following statements generate the same results as the preceding statements:
proc reg data=Fitness; model runtime= weight oxygen; run;