Cohen's d is the standardized mean difference between two samples. It is a commonly used measure of effect size. Other measures are eta-square and omega-square and partial versions of each. These are available in PROC GLM by using the EFFECTSIZE option in the MODEL statement.
The following computes Cohen's d for scores that are provided by samples of males and females. PROC TTEST provides basic statistics as well as a test of the mean difference and confidence limits. The statements following PROC TTEST obtain the sample sizes, means, and standard deviations of the samples and compute Cohen's d along with its standard error and a 95% large-sample confidence interval:
data x;
input Gender $ Score @@;
datalines;
f 75 f 76 f 80 f 77 f 80 f 77 f 73
m 82 m 80 m 85 m 85 m 78
;
proc ttest data=x;
class gender; var score;
ods output statistics=stat;
run;
data stat1; set stat;
if _n_=1 then do;
class1=class; n1=n; m1=mean; s1=stddev;
keep class1 n1 m1 s1;
output;
end;
run;
data stat2; set stat;
if _n_=2 then do;
class2=class; n2=n; m2=mean; s2=stddev;
keep class2 n2 m2 s2;
output;
end;
run;
data stats; merge stat1 stat2;
length Label $50;
Alpha=.05; ConfLevel=1-Alpha;
Label=cats(class1," - ",class2);
MeanDiff=m1-m2;
PoolStdDev=sqrt(((n1-1)*s1**2+(n2-1)*s2**2)/(n1+n2-2));
d=MeanDiff/PoolStdDev;
se_d=sqrt(((n1+n2)/(n1*n2)) + (d**2/(2*(n1+n2-2))));
lcld=d-quantile('normal',1-alpha/2)*se_d;
ucld=d+quantile('normal',1-alpha/2)*se_d;
run;
proc print;
id Label;
var MeanDiff PoolStdDev d se_d lcld ucld conflevel;
title "Cohen's D and Confidence Limits";
run;
For the female - male difference, Cohen's d = -1.855 with 95% large-sample confidence interval (-3.262, -0.449). If the male - female difference is preferred, reverse the levels in the Label= and MeanDiff= statements in the DATA STATS step above. You can change the confidence level of the confidence interval by changing the value in the Alpha= statement.