SAS Proc Freq1- Risk Difference

SAS day 8:  Proc Freq Risk Difference

Goal :

  • What is Risk Difference?
  • How to interpret Risk Difference Confidence Interval.


Risk Difference is used to compare the proportions of successes between two independent groups with respect to a binary outcome. (cancer remission).
If the outcome is continuous, we compare the difference in means instead.

Risk Difference:

    \[RD= p1- p2\]

where p1= x1/n1 (x1 is the successes in group 1) ,
p2=x2/n2  (x2 is the successes in group 2).

ColiN00B / Pixabay


H0 (Null Hypotheses) :  p1- p2= 0 : there is no difference in outcomes between Treatment A and Placebo.


 Treatment ATreatment BPlacebo
Difference From Placebo1811.3
p-value for difference0.00040.067
97.5% CI for Difference(9.2,35,6)(-2.2,22.3)



We are 95% confident that the difference in proportion in Treatment A and Placebo is (9.2, 35.6), therefore we conclude the treatment outcome difference in success is significant.

Note: If we use the WALD option, we might get negative values for CI, which means, the difference is not significant.


SAS Code:

where (trt01pn in (1 2 ));
BY avisitn ;
TABLES trt01pn*aval / riskdiff(cl=wald) alpha=0.025;
exact riskdiff;

data riskci;
set riskci;
col1 = put(-riskdifference*100, 4.1);
keep avisitn col1;


Happy SAS Coding 😍!

Thanks very much to Renee 5, Shared the Risk Diff knowledge with me ! 🍉



Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Social media & sharing icons powered by UltimatelySocial
%d bloggers like this: