Hello -
I have a dataset with imputed data. The data is matched, so I'm using PROC FREQ with McNemar's test. Is it possible to get an overall McNemar's result from MIANALYZE? I can not figure out how to enter this into MIANALYZE since a standard error is not output.
THANKS!!
PROC FREQ DATA=IMPUTED;
TABLES status_in*status_out / agree;
ods output McNemarsTest=mcnx;
BY _Imputation_;
RUN;
Although it is easier to program with IML, you don't necessarily need to use it. You could use Proc MEANS and a Data Step to do the same thing. The code below will replicate the example he has in the header of the program. You could probably turn this into a MACRO if you had a lot of these to do, but the gist of it would be:
data test;
input g2 @@;
g=sqrt(g2);
cards;
5.8 7.2 6.1 8.5
;
proc means data=test;
var g2 g;
output out=out1 sum=sum_g2 sum_g n=m uss=ssq_g2 ssq_g;
run;
data out1;
set out1;
df=3;
mg2=sum_g2/m;
r=(1+1/m)*(ssq_g-(sum_g**2)/m)/(m-1);
f=(mg2/df - r*(m-1)/(m+1))/(1+r);
ddf=(m-1)*(1+1/r)**2/df**(3/m);
p=1-probf(f,df,ddf);
run;
proc print;
run;
There isn't a way to combine the test statistics directly in MIANALYZE but you could use Dr. Paul Allison's %COMBCHI macro to combine the actual Chi-Square statistics and get a single p-value.
Although it is easier to program with IML, you don't necessarily need to use it. You could use Proc MEANS and a Data Step to do the same thing. The code below will replicate the example he has in the header of the program. You could probably turn this into a MACRO if you had a lot of these to do, but the gist of it would be:
data test;
input g2 @@;
g=sqrt(g2);
cards;
5.8 7.2 6.1 8.5
;
proc means data=test;
var g2 g;
output out=out1 sum=sum_g2 sum_g n=m uss=ssq_g2 ssq_g;
run;
data out1;
set out1;
df=3;
mg2=sum_g2/m;
r=(1+1/m)*(ssq_g-(sum_g**2)/m)/(m-1);
f=(mg2/df - r*(m-1)/(m+1))/(1+r);
ddf=(m-1)*(1+1/r)**2/df**(3/m);
p=1-probf(f,df,ddf);
run;
proc print;
run;
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.