If you want the correct answer for a risk ratio in SAS for a 2x2 table or a stratified 2x2 table using the FREQ procedure, you need to be careful with the configuration and the coding. We found this out the hard way! For example, for a generic 2x2 table where the RR is the ratio of the Experimental to the Control proportion: Outcome Yes No Tmt Experimental 4 332 Control 7 348 It is extremely important on the “order” of both the Treatment and Outcome label values. For example, the data coding below for “tmt” and “outcome” will not give you what you want! DATA tab2x2 ;
input tmt $ outcome $ freq ;
datalines ;
Exp Yes 4
Exp No 332
Ctl Yes 7
Ctl No 348
; However, if you “order” the label values correctly, as shown below, for example: Outcome Yes No Tmt Experimental 1, 1 1, 2 Control 2, 1 2, 2 DATA tab2x2;
input tmt $ outcome $ freq;
datalines;
1Exp 1Yes 4
1Exp 2No 332
2Ctl 1Yes 7
2Ctl 2No 348
; This will give you the correct RR estimate. Also, in the TABLE statement, the “tmt” factor must be listed before the “outcome” variable. For stratified tables, the stratum factor must be the first variable (e.g. stratum*tmt*outcome): proc FREQ data=tab2x2 ;
TABLE tmt*outcome / relrisk ;
Weight freq ;
run ; The output is shown below. WRONG answers! Frequency Percent Row Pct Col Pct Table of tmt by outcome tmt outcome No Yes Total Ctl 348 50.36 98.03 51.18 7 1.01 1.97 63.64 355 51.37 Exp 332 48.05 98.81 48.82 4 0.58 1.19 36.36 336 48.63 Total 680 98.41 11 1.59 691 100.00 Odds Ratio and Relative Risks Statistic Value 95% Confidence Limits Odds Ratio 0.5990 0.1737 2.0649 Relative Risk (Column 1) 0.9921 0.9736 1.0110 Relative Risk (Column 2) 1.6563 0.4893 5.6069 RIGHT answer! Frequency Percent Row Pct Col Pct Table of tmt by outcome tmt outcome 1Yes 2No Total 1Exp 4 0.58 1.19 36.36 332 48.05 98.81 48.82 336 48.63 2Ctl 7 1.01 1.97 63.64 348 50.36 98.03 51.18 355 51.37 Total 11 1.59 680 98.41 691 100.00 Odds Ratio and Relative Risks Statistic Value 95% Confidence Limits Odds Ratio 0.5990 0.1737 2.0649 Relative Risk (Column 1) 0.6037 0.1784 2.0437 Relative Risk (Column 2) 1.0080 0.9891 1.0272
... View more