Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Analytics
- /
- Stat Procs
- /
- Percentage of responders for difference between two groups and placebo

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

🔒 This topic is **solved** and **locked**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 11-15-2018 07:31 AM
(3689 views)

Hi all,

Could you please help and explain how to calculate "Percentage of responders for two groups and total" using SAS. I need to evaluate efficacy in one experiment. Please see the the table below. Difference and p-value should be calculated just for Visit Final.

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

There are several ways you can make this comparison. The RISKDIFF option in PROC FREQ compares the two proportions. Also, you can fit a simple logistic model and use the LSMEANS statement to make the comparison. Finally, the Margins macro also fits a logistic model and does the comparison of Dosegroup margins, which are the proportions. They all provide the separate proportions and a test or confidence interval comparing them, all indicating no significant difference. Code for all three methods follow. But note that your table shows that there is a Placebo group. A proper analysis would include the data for that group. If that data is included, you could still use the PROC LOGISTIC and Margins macro approaches to make comparisons among the three groups.

```
proc freq data=test;
table dosegroup*respond / riskdiff;
run;
proc logistic data=test;
class dosegroup / param=glm;
model respond(event='Y')=dosegroup;
lsmeans dosegroup / ilink diff cl;
run;
data test; set test; y=(respond='Y'); run;
%margins(data = test,
class = dosegroup,
response = y,
roptions = event='1',
model = dosegroup,
dist = binomial,
margins = dosegroup,
options = cl diff nomodel)
```

16 REPLIES 16

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Recall that a percentage and a proportion are mathematically equivalent. For example, 75% and the proportion 0.75 are the same.

It sounds like you want an estimate of the binomial proportion for the two groups. There is an example in the PROC FREQ documentation that you can look at. The following example shows the general idea for using the BINOMIAL option:

```
proc freq data=Sashelp.Class;
tables sex / binomial(level='F');
run;
```

Sex | Frequency | Percent | Cumulative Frequency |
Cumulative Percent |
---|---|---|---|---|

F | 9 | 47.37 |
9 | 47.37 |

M | 10 | 52.63 |
19 | 100.00 |

Binomial Proportion | |
---|---|

Sex = F | |

Proportion | 0.4737 |

ASE | 0.1145 |

95% Lower Conf Limit | 0.2492 |

95% Upper Conf Limit | 0.6982 |

Exact Conf Limits | |

95% Lower Conf Limit | 0.2445 |

95% Upper Conf Limit | 0.7114 |

Sample Size = 19 |

The output tells you that the proportion of females in this sample is 47.37%. A 95% confidence interval for the proportion is [0.2492, 0.6982], or approximately 25% to 70%..

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Hi Rick,

Thank you very much for the detailed answer. For me, as for beginner, is not clear how to manage two groups. Using your link I have prepared the example dataset:

```
data test;
input DoseGroup $ Respond $ @@;
label DoseGroup ='Group'
Respond ='Respond';
datalines;
Dose1 Y Dose1 N Dose1 Y Dose1 Y
Dose1 Y Dose2 Y Dose1 N Dose1 Y
Dose1 N Dose1 N Dose1 Y Dose1 Y
Dose2 Y Dose2 Y Dose2 Y Dose2 N
Dose2 N Dose2 Y Dose2 N Dose2 N
Dose2 N Dose2 N Dose2 Y Dose2 Y
Dose1 Y Dose1 N Dose1 Y Dose1 Y
Dose1 Y Dose1 Y Dose2 N Dose1 Y
Dose1 N Dose1 N Dose2 Y Dose1 Y
Dose2 Y Dose2 Y Dose2 Y Dose2 N
Dose2 N Dose2 Y Dose2 N Dose2 N
Dose2 N Dose2 N Dose2 Y Dose2 Y
Dose1 Y Dose1 N Dose1 Y Dose1 Y
Dose1 N Dose1 N Dose2 Y Dose1 Y
Dose2 Y Dose2 Y Dose2 Y Dose2 N
Dose2 Y Dose2 Y Dose2 N Dose2 Y
Dose2 N Dose2 N Dose2 Y Dose2 Y
;
run;
```

Could you please use it for the analysis? Thank you!

Here is the case in graphic view:

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

If you want to perform three separate analysis of the proportions (All, DoseGroup='Dose1', DoseGroup='Dose2'), then you can use the following.

```
proc sort data=test; by DoseGroup; run;
title "Estimate and CI for Total Proportion";
title2 "All Groupts";
proc freq data=test;
table Respond / binomial(level='Y');
run;
title "Estimate and CI by Groups";
proc freq data=test;
by DoseGroup;
table Respond / binomial(level='Y');
run;
```

The results are

ALL 0.6029 CI (0.4866, 0.7192)

Dose1 0.6429 CI (0.4407, 0.8136)

Dose2 0.5750 CI (0.4218, 0.7282)

I can't comment on the p-value because I don't know what statistical test you want to run. If you are testing whether the proportions are 0.5, then see the one-sided or two-sided p-values in the "Test of H0" tables in the output.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Hi Rick,

**The Pearson Chi-square test should be used and the 95% confidence interval (asymptotic calculation) for each treatment ****difference**.

Could you please prompt how to specify the requirements in the Proc Freq? Thank you!

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

For a one-way table, the CHISQ option performs a chi-square test for equal proportions.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Thank you!

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

There are several ways you can make this comparison. The RISKDIFF option in PROC FREQ compares the two proportions. Also, you can fit a simple logistic model and use the LSMEANS statement to make the comparison. Finally, the Margins macro also fits a logistic model and does the comparison of Dosegroup margins, which are the proportions. They all provide the separate proportions and a test or confidence interval comparing them, all indicating no significant difference. Code for all three methods follow. But note that your table shows that there is a Placebo group. A proper analysis would include the data for that group. If that data is included, you could still use the PROC LOGISTIC and Margins macro approaches to make comparisons among the three groups.

```
proc freq data=test;
table dosegroup*respond / riskdiff;
run;
proc logistic data=test;
class dosegroup / param=glm;
model respond(event='Y')=dosegroup;
lsmeans dosegroup / ilink diff cl;
run;
data test; set test; y=(respond='Y'); run;
%margins(data = test,
class = dosegroup,
response = y,
roptions = event='1',
model = dosegroup,
dist = binomial,
margins = dosegroup,
options = cl diff nomodel)
```

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

I have added the Placebo group. Could you please specify the 'Proc Logistic' for the three groups and placebo? Thank you!

```
data test;
input DoseGroup $ Respond $ @@;
label DoseGroup ='Group'
Respond ='Respond';
datalines;
Placebo Y Placebo N Dose1 Y Placebo Y
Placebo N Placebo N Dose2 Y Placebo Y
Dose1 Y Dose1 N Dose1 Y Placebo Y
Dose1 Y Dose2 Y Dose1 N Dose1 Y
Dose1 Y Dose2 Y Dose1 N Dose1 Y
Placebo N Placebo N Dose1 Y Dose1 Y
Dose2 Y Placebo Y Dose2 Y Dose2 N
Placebo N Dose2 Y Dose2 N Dose2 N
Dose2 N Dose2 N Placebo Y Dose2 Y
Placebo N Placebo N Dose1 Y Dose1 Y
Dose2 Y Placebo Y Dose2 Y Dose2 N
Placebo N Dose2 Y Dose2 N Dose2 N
Dose2 N Dose2 N Placebo Y Dose2 Y
Placebo Y Placebo N Dose1 Y Placebo Y
Placebo N Placebo N Dose2 Y Placebo Y
Dose1 Y Placebo Y Dose2 N Dose1 Y
Dose1 N Dose1 N Dose2 Y Dose1 Y
Dose1 Y Dose2 Y Dose1 N Dose1 Y
Dose1 Y Dose2 Y Dose1 N Dose1 Y
Dose1 Y Dose2 Y Dose1 N Dose1 Y
Dose1 N Placebo N Dose2 Y Dose1 Y
Dose2 Y Dose2 Y Placebo Y Dose2 N
Placebo Y Placebo N Dose1 Y Placebo Y
Placebo N Placebo N Dose2 Y Placebo Y
Dose2 Y Placebo Y Dose2 N Placebo Y
Dose1 Y Placebo Y Dose2 N Dose1 Y
Dose1 N Dose1 N Dose2 Y Dose1 Y
Dose1 N Placebo N Dose2 Y Dose1 Y
Dose1 Y Placebo Y Dose1 N Dose1 Y
Dose1 Y Placebo Y Dose1 N Dose1 Y
Dose2 Y Dose2 Y Placebo Y Dose2 N
Dose1 Y Dose2 Y Dose1 N Dose1 Y
Dose1 Y Placebo Y Dose1 N Dose1 Y
Dose2 Y Placebo Y Dose2 N Placebo Y
Dose1 Y Dose2 Y Dose1 N Dose1 Y
Placebo Y Placebo N Dose1 Y Placebo Y
Placebo N Placebo N Dose2 Y Placebo Y
Dose2 N Placebo N Placebo Y Dose2 Y
Placebo Y Dose2 Y Dose2 Y Dose2 N
Dose2 N Dose2 Y Placebo N Dose2 N
Dose2 N Dose2 N Dose2 Y Dose2 Y
Dose1 Y Dose1 N Dose1 Y Dose1 Y
Dose1 N Placebo N Dose2 Y Dose1 Y
Placebo Y Placebo N Dose1 Y Placebo Y
Placebo N Placebo N Dose2 Y Placebo Y
Dose2 Y Dose2 Y Placebo Y Dose2 N
Dose2 Y Placebo Y Dose2 N Placebo Y
Dose2 N Placebo N Placebo Y Dose2 Y
;
run;
proc logistic data=test;
class dosegroup / param=glm;
model respond(event='Y')=dosegroup;
lsmeans dosegroup / ilink diff cl;
run;
```

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

You can run the code exactly as you showed it. The two Least Squares Means tables give you the three group proportions and the pairwise comparisons.

Note that you are assuming that the responses in the three groups are all independent.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Use the ALPHA= option in the LSMEANS statement.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Thanks!

And the second question: what is the syntax of Proc Freq for the same purpose? I saw the link provided in the topic but need some help anyway (.

When I'm running the code:

```
proc freq data=test;
table dosegroup*respond / riskdiff;
run;
```

I receive just frequency table.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Thank you, Dave. Is the criteria in Proc Logistics - CHISQ?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. **Registration is now open through August 30th**. Visit the SAS Hackathon homepage.

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.