BookmarkSubscribeRSS Feed
mb_1
Calcite | Level 5

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.

SubjectWhether >=5% reduction in weightTreatmentSex
1111
2021
3131
4140
5111
6000
7000
8141
9020
10030

 

How should I calculate the common risk difference?

8 REPLIES 8
StatDave
SAS Super FREQ

Use one of the methods discussed and illustrated in this note

mb_1
Calcite | Level 5

Are any of these methods based on the minimum risk weight approach by Mehrotra and Railkar?

Ksharp
Super User
/*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;

Ksharp_0-1705374220068.png

 

mb_1
Calcite | Level 5

In the example code, what does the column=2 option work?

Also, it is giving me the following output.

mb_1_0-1705494904119.png

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.xxx0.xxx
Ksharp
Super User
“In the example code, what does the column=2 option work?”
That means using the second column 's risk to build riskdiff .
Here is risk when sex=Male (a.k.a count of Male When Status='Alive' / count of Status='Alive') <---Risk of Row1

or (a.k.a count of Male When Status='Dead' / count of Status='Dead') . <-----Risk of Row2

RiskDiff= Risk of Row1 - Risk of Row2 .


"Does "controlling for treatment" mean treatment is the stratifying factor?"
Yes. That is correct.


"i.e., sex comparing between each treatment group and placebo."
You need to know which variable(the strata variable) to adjust .
Only include the strata/third variable, you could get COMMON Risk Diff.
and make sure the ROW and COLUMN variables both must have TWO levels.
mb_1
Calcite | Level 5

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? 

Ksharp
Super User

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;

Ksharp_0-1705628560490.png

 

 

 

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
  • 8 replies
  • 980 views
  • 4 likes
  • 3 in conversation