A. Pearson Correlation: Between continuous variable and continuous variable.
%macro corr (in, year);
Title "Check Correlation - &in. group";
proc corr data= &in._&year.
outp=corr_&in._&year.
plot=(matrix scatterplot);
var exper salary ;
run;
%mend corr;
- Variables Information
- Simple Statistics (N, Mean, Std Dev, Sum, Min, Max, Label
- Pearson Correlations (Correlation Coefficients, Prob)
- Scatter Plots
- Scatter Plots Matrix
B. Polyserial Correlation: Between continuous variable and categorical variable.
%macro corr (in, year);
ods output polyserialCorr=corr_polys_&in._&year. ;
Title "Check Polyserial Correlation - &in. group";
proc corr data= &in._&year. pearson polyserial;
with gender minority rank;
var exper salary;
run;
%mend corr;
- Variables Information
- Simple Statistics
- Person Correlations
- PolyserialCorr (Wald Test, LR Test)
C. Polychoric Correlation: Between categorical variable and categorical variable.
%macro corr (in, year);
ods output measures=plcorr_&in._&year. (where=(statistic="Polychoric Correlation"));
Title "Check Polychoric Correlation - &in. group";
proc freq data= &in._&year.;
tables gender*rank minority*rank / plcorr;
run;
%mend corr;
- Cross-Tabular Freq Table
- Measures of Association (Polychoric Correlation)
D. Partial Correlation: Pearson correlation between variables while controlling other variables. Following example checks the correlation between salary and gender, controlling for rank and experience.
%macro partial (in, year);
Title "Check Partial Correlation for basesal and gender - &in. group";
proc corr data=&in._&year. plots=scatter(alpha=.20 .30);
var salary gender ; /* treat gender as continuous */
partial rank exper;
run;
%mend partial;