Tags:
create new tag
, view all tags, tagging instructions
Return to Stat Tools Home

Title: Pearson and Spearman Correlations

Evaluate this tool by clicking on the stars:

  • 5 stars = highest rating
  • 1 star = lowest
  • SCORE = average of all votes
Tools Overall Rating
Score: 0, My vote: 0, Total votes: 0
Code Works Well
Score: 0, My vote: 0, Total votes: 0
Good Instructions
Score: 0, My vote: 0, Total votes: 0

Add Comments and then click on "Add comment" button

Please note any errors found in the macros.

 

StatToolsForm edit

Type of Tool SAS Macro
Title Pearson and Spearman Correlations
Programmer/Email AlanBostrom
Contributing Site UCSF
Description The corr macro produces Pearson and/or Spearman correlations with 95% confidence intervals and P-Values.

Variable lists can be crossed or paired.The second variable list can be omitted to generate all non-redundant pairs of the first list. Output can be sorted by variable name or according to the list order or by absolute Pearson or Spearman value. Missing values can be deleted on a listwise or pairwise basis.
Classification Graph Type

References

Datasets

Data

Software Program SAS
Software SAS
Macro Parameters DSName = data set name
IVar = 1st variable list (cannot be empty)
JVar = 2nd variable list (can be empty)
Pairs = X|P If X, then all IVar variables paired with all JVar variables. If P, then the 1st IVar variable is paired with the 1st JVar variable, etc. This option requires the two lists to have the same number of variables. This option is ignored if JVar list is empty. Default is X.
Missing = L|P If L, then listwise deletion of missing values, otherwise pairwise deletion of missing values. Default is P.
ByVars = any By variables
Print = Y|N. Default is Y.
Out = output data set
Label = Y|N to label printed output. Default is Y.
Sort = A|O|P|S. If A, then output is sorted by IVar variable name, then JVar name within IVar. If O, then the original order in IVar with each IVar paired with each JVar. If P, output is sorted by descending absolute Pearson correlation. If S, output is sorted by descending absolute Spearman correlation. Default is O.
R-Code - Attachment

R-Code

SAS-Code - Attachment UCSF_Correlation_Main Macro
SAS-Code

Stata-Code - Attachment

Stata-Code

Other Code - Attachment

Other Code

Called Data Manipulation

Called Tool/Utility

Called Checking Macro

Called Other

Creation-Date

Revision-Date March 20, 2009
Example Code

Example Output

SAS Examples

SAS_Example_Code

SAS_Example_Output

R Examples

R_Example_Code

R_Example_Output

Stats Examples

Special Features

Special Features Attached

Special Features Text

Notes1-Legend Section with calls to needed macros
Notes1

Notes2-Legend Macro call with fully specified parameters
Notes2

Notes3-Legend Section with definitions of global macro parameters
Notes3

Notes4-Legend Section with definitions of local macro variables
Notes4

See Also %corr(DSName=sample,IVar=Age Weight Height, JVar=DeltaWeight,ByVars=Treatment,Print=Y)

Three Pearson and Spearman correlations with 95% confidence limits and P-values will be produced for each level of Treatment. Missing values will be deleted on a pairwise basis and the order of the correlations will be the order given in the JVar list.
Checklists Checklist for Corr Macro
Stat Tools Disclaimer

Discliamer The views expressed within CTSpedia are those of the author and must not be taken to represent policy or guidance on the behalf of any organization or institution with which the author is affiliated.
Permission Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT OLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Reference Image

Topic revision: r9 - 21 Jun 2012 - 14:10:54 - MaryBanach
 

Copyright & by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding CTSPedia? Send feedback