210 likes | 597 Views
So you want to correlate. SAS's Proc Corr is the way to goProc Corr data=Data1;Default is Pearson correlationProduces a correlation matrix of continuous variablesBut will try to correlate anything you tell it to.Provides descriptive statisticsDoes pairwise or listwise deletion. Pairwise
E N D
1. Jacob Seybert
10/22/09 Correlation!
2. So you want to correlate… SAS’s Proc Corr is the way to go
Proc Corr data=Data1;
Default is Pearson correlation
Produces a correlation matrix of continuous variables
But will try to correlate anything you tell it to.
Provides descriptive statistics
Does pairwise or listwise deletion
3. Pairwise vs. Listwise Deletion Listwise deletion - if any data is missing deletes entire case from analysis
For listwise deletion use a NOMISS statement
Proc Corr data=Data1 NOMISS;
Pairwise deletion - uses the data it can, to correlate variables
Default
4. Proc Corr Syntax Default with no Var statement is to correlate all variables using Pearson
Proc Corr data=Data1 <OPTIONS>;
Var var1 var2 var3;
By groupingvariable; *Data must have been sorted previously;
Run;
5. <Options>! No brackets < >
Can have more than one!
Options:
NOMISS - Exclude observations with missing analysis values from the analysis
PEARSON - Request Pearson product-moment correlation
SPEARMAN - Request Spearman rank-order correlation
FISHER PEARSON - Request Pearson correlation statistics using Fisher's z transformation
FISHER SPEARMAN - Request Spearman rank-order correlation statistics using Fisher’s z transformation
ALPHA - Compute Cronbach's coefficient alpha
6. Example “CorrExample.sas”
No statements:
7. No Statement Results
8. Example Continued With a By statement
9. By Statement Results
10. Example Continued Testing for correlation for specific variables
11. 3 Variable Results
12. Other Run Combinations Separately by gender for 3 variables
With listwise deletion
And more…
13. More <Options>! No brackets < >
Same location as noted previously
Options:
BEST= - Display a specified number of correlation coefficients
NOCORR - Suppress Pearson correlations
NOPRINT - Suppress all printed output
NOPROB - Suppress p-values
NOSIMPLE - Suppress descriptive statistics
RANK - Displays the ordered correlation coefficients for each variable, from highest to lowest.
14. Options Example Listwise deletion
Rank
With SPEARMAN correlations
Calculating coefficient apha
15. Outputs Output Results
16. Creating Scatterplots of Data Proc GPLOT data=Data1;
plot SelfEst*SupportParnt;
Symbol1 Value = x INTERPOL = rl;
Run;
Value = the symbol to use to represent the datapoint
Interpol= if you want to draw a line between points based on the left, right or center of the data.
rl command tells it to create a new point to the right and left of each statement
17. Symbols Used to Plot
18. Example:
19. Or… Use Excel! Have to delete missing values yourself
Steps:
Highlight the two columns of data to plot
Click “Insert”
Click “Scatter” arrow
Add a trend line
20. Scatterplot in Excel
21. Add a Trend Line
22. Brannick’s Excel Correlation Spreadsheet
Provides a variety of useful correlation coefficent tests.
Will help with homework
Lets play with it!