The CORR Procedure

WITH Statement

  • WITH variables;

The WITH statement lists variables with which correlations of the VAR statement variables are to be computed. The WITH statement requests correlations of the form r left parenthesis upper X Subscript i Baseline comma upper Y Subscript j Baseline right parenthesis, where upper X 1 comma ellipsis comma upper X Subscript m Baseline are analysis variables specified in the VAR statement, and upper Y 1 comma ellipsis comma upper Y Subscript n Baseline are variables specified in the WITH statement. The correlation matrix has a rectangular structure of the form

Start 3 By 3 Matrix 1st Row 1st Column r left parenthesis upper Y 1 comma upper X 1 right parenthesis 2nd Column midline horizontal ellipsis 3rd Column r left parenthesis upper Y 1 comma upper X Subscript m Baseline right parenthesis 2nd Row 1st Column vertical ellipsis 2nd Column down right diagonal ellipsis 3rd Column vertical ellipsis 3rd Row 1st Column r left parenthesis upper Y Subscript n Baseline comma upper X 1 right parenthesis 2nd Column midline horizontal ellipsis 3rd Column r left parenthesis upper Y Subscript n Baseline comma upper X Subscript m Baseline right parenthesis EndMatrix

For example, the statements

proc corr;
   var x1 x2;
   with y1 y2 y3;
run;

produce correlations for the following combinations:

StartLayout 1st Row  Start 3 By 2 Matrix 1st Row 1st Column r left parenthesis upper Y Baseline 1 comma upper X Baseline 1 right parenthesis 2nd Column r left parenthesis upper Y Baseline 1 comma upper X Baseline 2 right parenthesis 2nd Row 1st Column r left parenthesis upper Y Baseline 2 comma upper X Baseline 1 right parenthesis 2nd Column r left parenthesis upper Y Baseline 2 comma upper X Baseline 2 right parenthesis 3rd Row 1st Column r left parenthesis upper Y Baseline 3 comma upper X Baseline 1 right parenthesis 2nd Column r left parenthesis upper Y Baseline 3 comma upper X Baseline 2 right parenthesis EndMatrix EndLayout
Last updated: April 16, 2025