Lapis Lazuli | Level 10

Percentage of responders for difference between two groups and placebo

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
SAS Super FREQ

Re: Percentage of responders for difference between two groups and placebo

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
SAS Super FREQ

Re: Percentage of responders for difference between two groups and placebo

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%..

Lapis Lazuli | Level 10

Re: Percentage of responders for difference between two groups and placebo

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:

SAS Super FREQ

Re: Percentage of responders for difference between two groups and placebo

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.

Lapis Lazuli | Level 10

Re: Percentage of responders for difference between two groups and placebo

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!

SAS Super FREQ

Re: Percentage of responders for difference between two groups and placebo

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

Lapis Lazuli | Level 10

Thank you!
SAS Super FREQ

Re: Percentage of responders for difference between two groups and placebo

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)
``````
Lapis Lazuli | Level 10

Re: Percentage of responders for difference between two groups and placebo

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;``````
SAS Super FREQ

Re: Percentage of responders for difference between two groups and placebo

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.

Lapis Lazuli | Level 10

Re: Percentage of responders for difference between two groups and placebo

Thank you. It gradually(and slowly) becomes more and more clear). I have a question - how to specify CI not 95% but different one?

SAS Super FREQ

Re: Percentage of responders for difference between two groups and placebo

Use the ALPHA= option in the LSMEANS statement.
Lapis Lazuli | Level 10

Re: Percentage of responders for difference between two groups and placebo

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;``````

SAS Super FREQ

Re: Percentage of responders for difference between two groups and placebo

The RISKDIFF option only applies to a 2x2 table. So, it is only available for a two group case. See the note in the SAS log that specifically says this when you run that code. That's why I said that when you use all the data with all three groups, you can use the PROC LOGISTIC or Margins macro approaches.

Lapis Lazuli | Level 10

Re: Percentage of responders for difference between two groups and placebo

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

Discussion stats
• 16 replies
• 3690 views
• 5 likes
• 3 in conversation