Usage Note 63084: Saving correlations in a list format
To display or save the Pearson and/or Spearman correlations in a list format rather than the matrix format generated by default by PROC CORR, specify the FISHER option together with the PEARSON and/or SPEARMAN options. You can save the correlations in list format using the corresponding ODS tables FisherPearsonCorr and FisherSpearmanCorr. This is illustrated in the following example.
Example
These statements generate the fitness data set to analyze correlations between variables related to fitness.
data Fitness;
input Age Weight Oxygen RunTime @@;
datalines;
44 89.47 44.609 11.37 40 75.07 45.313 10.07
44 85.84 54.297 8.65 42 68.15 59.571 8.17
38 89.02 49.874 . 47 77.45 44.811 11.63
40 75.98 45.681 11.95 43 81.19 49.091 10.85
44 81.42 39.442 13.08 38 81.87 60.055 8.63
44 73.03 50.541 10.13 45 87.66 37.388 14.03
45 66.45 44.754 11.12 47 79.15 47.273 10.60
54 83.12 51.855 10.33 49 81.42 49.156 8.95
51 69.63 40.836 10.95 51 77.91 46.672 10.00
48 91.63 46.774 10.25 49 73.37 . 10.08
57 73.37 39.407 12.63 54 79.38 46.080 11.17
52 76.32 45.441 9.63 50 70.87 54.625 8.92
51 67.25 45.118 11.08 54 91.63 39.203 12.88
51 73.71 45.790 10.47 57 59.08 50.545 9.93
49 76.32 . . 48 61.24 47.920 11.50
52 82.78 47.467 10.50
;
In the following PROC CORR step, the FISHER option is specified along with the PEARSON and SPEARMAN options to estimate the Pearson and Spearman correlations among the variables in the Fitness data set. The FisherPearsonCorr and FisherSpearmanCorr tables are saved as data sets PearsonCorrs and SpearmanCorrs using an ODS OUTPUT statement.
proc corr data=Fitness fisher pearson spearman;
ods output
fisherpearsoncorr = PearsonCorrs
fisherspearmancorr = SpearmanCorrs;
run;
The displayed results from PROC CORR include the default matrix format display of the correlations. The FISHER option adds the second pair of tables which use a list format showing pairwise correlations among the variables. This second set of tables is saved as data sets by the ODS OUTPUT statement.
| 31 |
-0.23354 |
-0.23793 |
-0.00389 |
-0.22986 |
-0.540198 |
0.135522 |
0.2080 |
| 29 |
-0.31474 |
-0.32580 |
-0.00562 |
-0.30967 |
-0.607253 |
0.064116 |
0.0967 |
| 29 |
0.14478 |
0.14581 |
0.00259 |
0.14225 |
-0.236588 |
0.483547 |
0.4572 |
| 29 |
-0.15358 |
-0.15480 |
-0.00274 |
-0.15090 |
-0.490289 |
0.228229 |
0.4299 |
| 29 |
0.20072 |
0.20348 |
0.00358 |
0.19727 |
-0.182422 |
0.525765 |
0.2995 |
| 28 |
-0.86843 |
-1.32665 |
-0.01608 |
-0.86442 |
-0.935728 |
-0.725221 |
<.0001 |
| 31 |
-0.16152 |
-0.16295 |
-0.00269 |
-0.15890 |
-0.485883 |
0.207101 |
0.3885 |
| 29 |
-0.20621 |
-0.20921 |
-0.00368 |
-0.20268 |
-0.529828 |
0.176973 |
0.2861 |
| 29 |
0.09989 |
0.10022 |
0.00178 |
0.09812 |
-0.278394 |
0.448500 |
0.6093 |
| 29 |
-0.06824 |
-0.06835 |
-0.00122 |
-0.06703 |
-0.423141 |
0.307018 |
0.7275 |
| 29 |
0.13749 |
0.13837 |
0.00246 |
0.13508 |
-0.243480 |
0.477925 |
0.4805 |
| 28 |
-0.80131 |
-1.10227 |
-0.01484 |
-0.79594 |
-0.901360 |
-0.601465 |
<.0001 |
|
These statements display the PearsonCorrs and SpearmanCorrs data sets and show the correlations in list format as displayed above. Variable labels, as shown above for the columns, are saved with the data and can be displayed instead of variable names by specifying the LABEL option in PROC PRINT as done in the second PROC PRINT step below.
proc print data=PearsonCorrs;
id Var WithVar;
run;
proc print data=SpearmanCorrs label;
id Var WithVar;
run;
| 31 |
-0.23354 |
-0.23793 |
-0.00389 |
-0.22986 |
-0.540198 |
0.135522 |
0.2080 |
| 29 |
-0.31474 |
-0.32580 |
-0.00562 |
-0.30967 |
-0.607253 |
0.064116 |
0.0967 |
| 29 |
0.14478 |
0.14581 |
0.00259 |
0.14225 |
-0.236588 |
0.483547 |
0.4572 |
| 29 |
-0.15358 |
-0.15480 |
-0.00274 |
-0.15090 |
-0.490289 |
0.228229 |
0.4299 |
| 29 |
0.20072 |
0.20348 |
0.00358 |
0.19727 |
-0.182422 |
0.525765 |
0.2995 |
| 28 |
-0.86843 |
-1.32665 |
-0.01608 |
-0.86442 |
-0.935728 |
-0.725221 |
<.0001 |
| 31 |
-0.16152 |
-0.16295 |
-0.00269 |
-0.15890 |
-0.485883 |
0.207101 |
0.3885 |
| 29 |
-0.20621 |
-0.20921 |
-0.00368 |
-0.20268 |
-0.529828 |
0.176973 |
0.2861 |
| 29 |
0.09989 |
0.10022 |
0.00178 |
0.09812 |
-0.278394 |
0.448500 |
0.6093 |
| 29 |
-0.06824 |
-0.06835 |
-0.00122 |
-0.06703 |
-0.423141 |
0.307018 |
0.7275 |
| 29 |
0.13749 |
0.13837 |
0.00246 |
0.13508 |
-0.243480 |
0.477925 |
0.4805 |
| 28 |
-0.80131 |
-1.10227 |
-0.01484 |
-0.79594 |
-0.901360 |
-0.601465 |
<.0001 |
|
Operating System and Release Information
| SAS System | Base SAS | OS/2 | | |
| Microsoft Windows 8 Enterprise 32-bit | | |
| Microsoft Windows 8 Enterprise x64 | | |
| Microsoft Windows 8 Pro 32-bit | | |
| Microsoft Windows 8 Pro x64 | | |
| Microsoft Windows 8.1 Enterprise 32-bit | | |
| Microsoft Windows 8.1 Enterprise x64 | | |
| Microsoft Windows Server 2003 Enterprise 64-bit Edition | | |
| Microsoft Windows Server 2003 Datacenter 64-bit Edition | | |
| Microsoft® Windows® for 64-Bit Itanium-based Systems | | |
| OpenVMS VAX | | |
| Macintosh | | |
| z/OS 64-bit | | |
| z/OS | | |
| Microsoft Windows 8.1 Pro 32-bit | | |
| Microsoft Windows XP 64-bit Edition | | |
| Microsoft® Windows® for x64 | | |
| Microsoft Windows 8.1 Pro x64 | | |
| Microsoft Windows 10 | | |
| Microsoft Windows 95/98 | | |
| Microsoft Windows 2000 Advanced Server | | |
| Microsoft Windows 2000 Datacenter Server | | |
| Microsoft Windows 2000 Server | | |
| Microsoft Windows 2000 Professional | | |
| Microsoft Windows NT Workstation | | |
| Microsoft Windows Server 2003 Datacenter Edition | | |
| Microsoft Windows Server 2003 Enterprise Edition | | |
| Microsoft Windows Server 2003 Standard Edition | | |
| Microsoft Windows Server 2003 for x64 | | |
| Microsoft Windows Server 2008 | | |
| Microsoft Windows Server 2008 R2 | | |
| Microsoft Windows Server 2008 for x64 | | |
| Microsoft Windows Server 2012 Datacenter | | |
| Microsoft Windows Server 2012 R2 Datacenter | | |
| Microsoft Windows Server 2012 R2 Std | | |
| Microsoft Windows Server 2012 Std | | |
| Microsoft Windows Server 2016 | | |
| Microsoft Windows Server 2019 | | |
| Microsoft Windows XP Professional | | |
| Windows 7 Enterprise 32 bit | | |
| Windows 7 Enterprise x64 | | |
| Windows 7 Home Premium 32 bit | | |
| Windows 7 Home Premium x64 | | |
| Windows 7 Professional 32 bit | | |
| Windows 7 Professional x64 | | |
| Windows 7 Ultimate 32 bit | | |
| Windows 7 Ultimate x64 | | |
| Windows Millennium Edition (Me) | | |
| Windows Vista | | |
| Windows Vista for x64 | | |
| 64-bit Enabled AIX | | |
| 64-bit Enabled HP-UX | | |
| 64-bit Enabled Solaris | | |
| ABI+ for Intel Architecture | | |
| AIX | | |
| HP-UX | | |
| HP-UX IPF | | |
| IRIX | | |
| Linux | | |
| Linux for x64 | | |
| Linux on Itanium | | |
| OpenVMS Alpha | | |
| OpenVMS on HP Integrity | | |
| Solaris | | |
| Solaris for x64 | | |
| Tru64 UNIX | | |
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
| Type: | Usage Note |
| Priority: | |
| Topic: | SAS Reference ==> Procedures ==> CORR Analytics ==> Descriptive Statistics Analytics ==> Exploratory Data Analysis Analytics ==> Multivariate Analysis
|
| Date Modified: | 2019-08-30 08:31:06 |
| Date Created: | 2018-10-17 10:15:22 |