Need to calculate common risk difference estimate for >=5% reduction in weight adjusting for sex between treatment groups 1,2,3,4 and the placebo group with 95% CI. The risk difference and 95% CI are based on the minimum risk weight approach by Mehrotra and Railkar. Currently I have data in the below format.
Subject | Whether >=5% reduction in weight | Treatment | Sex |
1 | 1 | 1 | 1 |
2 | 0 | 2 | 1 |
3 | 1 | 3 | 1 |
4 | 1 | 4 | 0 |
5 | 1 | 1 | 1 |
6 | 0 | 0 | 0 |
7 | 0 | 0 | 0 |
8 | 1 | 4 | 1 |
9 | 0 | 2 | 0 |
10 | 0 | 3 | 0 |
How should I calculate the common risk difference?
Use one of the methods discussed and illustrated in this note.
Are any of these methods based on the minimum risk weight approach by Mehrotra and Railkar?
/*Here is an example*/
data have;
set sashelp.heart(obs=1000 keep=bp_status status sex rename=(bp_status=treatment));
run;
proc freq data=have;
table treatment*status*sex/commonriskdiff(column=2 cl=MR );
run;
In the example code, what does the column=2 option work?
Also, it is giving me the following output.
Does "controlling for treatment" mean treatment is the stratifying factor?
I actually want the output in the following format where I get the common risk difference adjusted for the stratifying factor i.e., sex comparing between each treatment group and placebo.
Placebo (Normal) | Treatment 1 (High) | Treatment 2 (Optimal) | |
Estimated Common Risk Difference (95% CI) | - | xx (xx.x, xx.x) | xx (xx.x, xx.x) |
p-value | - | 0.xxx | 0.xxx |
The strata variable for the data I have is sex with 2 levels : male and female. There are 7 different treatment groups including placebo. The outcome variable has 2 levels: 0 and 1. Can you help me get the common risk estimates, min risk CI and p-value in the format I mentioned in last comment?
To calculate COMMON Risk Diff , you should have a nx2x2 contingency table.
So you need organize your data to form a nx2x2 table.
NOTE: updated
data have;
set sashelp.heart(obs=1000 keep=bp_status status sex rename=(bp_status=treatment));
run;
/*
1)Firstly , Get data for Optimal and Normal ,and using "Death" as a reference level (column=2)
2)Here the first row is Normal and second row is Optimal,so Risk Diff is Normal - Optimal
*/
proc freq data=have(where=(treatment in ('Optimal' 'Normal')));
table sex*treatment*status/commonriskdiff(column=2 cl=MR test=MR);
ods output CommonPdiff=CommonPdiff1 CommonPdiffTests=CommonPdiffTests1;
run;
/*
1)Secondly , Get data for Optimal and High ,and using "Death" as a reference level (column=2)
2)Here the first row is High and second row is Optimal,so Risk Diff is High - Optimal
*/
proc freq data=have(where=(treatment in ('Optimal' 'High')));
table sex*treatment*status/commonriskdiff(column=2 cl=MR test=MR);
ods output CommonPdiff=CommonPdiff2 CommonPdiffTests=CommonPdiffTests2;
run;
/*After getting datasets "CommonPdiff1" and "CommonPdiff2" , you could combine them together.*/
data want;
merge CommonPdiff1 CommonPdiff2(rename=(value=v lowercl=l uppercl=u))
CommonPdiffTests1 CommonPdiffTests2(rename=(Prob=P));
label='Common Risk Diff(95% CI)';
Optimal=.;
Normal=cats(put(value,8.2),'(',put(lowercl,8.2),',',put(uppercl,8.2),')');
High=cats(put(v,8.2),'(',put(l,8.2),',',put(u,8.2),')');
output;
label='Pvalue';
Optimal=.;
Normal=vvalue(Prob);
High=vvalue(P);
output;
run;
/*Print it*/
proc report data=want nowd;
column label Optimal Normal High;
run;
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.
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.