Appling t-test for comparison of proportion in a data step:

 

 

%let var1=female;

%let var2=male;

%let key=ENROLL_RATE;

Z=(&var1._&key-&var2._&key)/(SQRT((&var1._&key*(1-&var1._&key)/&var1._SAMPLE_N )+&var2._&key*(1-&var2._&key)/ &var2._SAMPLE_N ));

 

 

data &schoollevel.&var1;
retain group;
merge ueka1b ueka2b;
by group;

P1=M2_MET_pre_Mean;
P2=M2_MET_post1_Mean;

N1=M2_MET_pre_N;
N2=M2_MET_post1_N;

A=(P1*(1-P1))/N1;
B=(P2*(1-P2))/N2;
STDERR=sqrt(A+B);

Z=abs((P1-P2)/STDERR);
/*two tail 5%*/

P=(1-probnorm(Z))*2;

if P < 0.05 then SIG="*";

drop A B P1 P2 N1 N2;
run;

 

 

Leave a Reply