BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
tka726
Obsidian | Level 7

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;

1 ACCEPTED SOLUTION

Accepted Solutions
SAS_Rob
SAS Employee

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;

View solution in original post

5 REPLIES 5
SAS_Rob
SAS Employee

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.

https://www.sas.upenn.edu/~allison/combchi.sas 

tka726
Obsidian | Level 7
Thank you. Unfortunately I do not have PROC IML... do you happen to know if there is another way to do this?
tka726
Obsidian | Level 7
Is there any way to run PROC FREQ by imputation (not necessarily McNemars) and get results that can be input in MIANALYZE to get an overall p-value?
SAS_Rob
SAS Employee

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;

tka726
Obsidian | Level 7
Thank you!!!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is ANOVA?

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.

Discussion stats
  • 5 replies
  • 872 views
  • 0 likes
  • 2 in conversation