Rick,
If I could get more help. Attached is my code. I have applied the code as you laid out, but I am not able to replicate previous numbers that I have calculating the RFI. I have studies A-D with the numerator and denominator in my datalines. I know from previous research that the RFI for each study is 5, 5, 10 and 4. I am trying to reproduce the same code so that I can use SAS moving forward for these calculations. Again, the goal is to see the minimum number of nonevents that need to change to an event for each outcome measure in order for the nonsignificant p-value, as measured by Fisher's exact test, to become significant. Alpha level 0.05. Any help is greatly appreciated. Thank you
data rfi;
input study $ num1 denom1 num2 denom2;
N = denom1 + denom2;
sumEvents = num1 + num2;
do x = 0 to SumEvents;
/* write a 2x2 table for PROC FREQ to analyze */
Group=1; Event=1; Count=x; output;
Group=1; Event=0; Count=denom1-x; output;
Group=2; Event=1; Count=SumEvents-x; output;
Group=2; Event=0; Count=denom2-SumEvents+x; output;
end;
datalines;
A 3 151 3 149
B 3 151 2 149
C 5 125 2 50
D 3 57 2 60
;
run;
ods select none;
proc freq data=rfi;
by study x;
tables Event*Group / norow nocol nopercent;
exact fisher;
weight Count;
ods output FishersExact=FisherOut(where=(Name1='XP2_FISH'));
run;
ods select all;
proc sgpanel data=FisherOut;
panelby study;
series x=x y=nValue1 / markers;
refline 0.05 / axis=y label='0.05';
colaxis grid values=(0 1 2 3 4 5 6 7 8 9 10) label="Num Events for Group 1";
rowaxis grid label="Two-Sided p-value";
run;
data SolnLeftTail;
set FisherOut(rename=(nValue1=pValue));
by Study;
retain foundMax;
if first.study then do;
maxLeftEvents = .;
foundMax = 0;
end;
if NOT foundMax then do;
if pValue <= 0.05 then do;
maxLeftEvents = x;
output;
end;
else
foundMax = 1;
end;
run;
proc print data=SolnLeftTail;
var Study x pValue;
run;
*RFI- Study A - 5
Study B - 5
Study C - 10
Study D - 4;
... View more