Saturday, March 26, 2011

Correlation in SAS


To establish the linear  relationship between two variables  we can use correlation. We can use PROC CORR  in SAS to do this. The syntax is given below,

proc corr data=mylib.file1;
var variable1 variable2;
run;

This code will give the Pearson's Correlation Coefficient.  To find another correlation coefficient like Spearman’s , Kendall, etc... just type

proc corr data= mylib.file1 spearman;

If you want to find both of them in a single expression 

proc corr data= mylib.file1 spearman pearson;

Try these codes and give your feedback. Download different SAS data sets try these types of operations into it. You can visit http://www.principlesofeconometrics.com/sas.htm to download SAS data sets

No comments:

Post a Comment