I have a large dataset with test scores of individual students in different SCHOOL labeled GIRL as 0 or 1. I need to calculate the mean difference between boys and girls for each school using hedge's g (a fancier version of cohen's d), as well as the standard error and degrees of freedom of the pooled variance. The calculations for those aren't necessarily the problem. But I cannot get SAS to calculate them for each of the schools. PROC SORT DATA=exam;
BY school GIRL;
RUN;
PROC MEANS DATA=exam MEAN STD N;
ODS OUTPUT SUMMARY=SUM;
BY school GIRL;
VAR IQV;
RUN; I then transposed it such that each row represents 1 school with separate columns for boys and girls. The following formulas should be correct but it does not work: /* COHEN HEDGES */
PROC IML;
USE newdataset;
READ ALL VAR {Ngirl IQgirl Stdgirl Nboy IQboy Stdboy};
CLOSE newdataset;
N1=Ngirl;
N2=Nboy;
MU1=IQgirl;
MU2=IQboy;
S1=Stdgirl;
S2=Stdboy;
/*COHEN D*/
SIG_NUM=(N1-1)*(S1)*2+(N2-1)*(S2)*2;
DF=N1+N2-2;
SIG=SQRT(SIG_NUM/DF);
D=(MU1-MU2)/SIG;
VARD = (N1+N2)/(N1*N2)+ (D)**2/(2*(N1+N2));
/*HEDGES G*/
J=1-4/(4*DF-1);
G=J*D;
PRINT D[L='Cohen'] VARD[L='VAR D'] G[L='Hedges'];
RUN; How can I get this last bit to work and how do I save it into its own dataset? Or should I take a very different approach entirely? (I am very new to SAS, so I don't know). I use the online SAS studio
... View more