Sample Size Calculation in SAS for Clinical Trials and BA/BE Studies: One-Sample, Two-Sample, Crossover and Replicate Designs

Sample size formulas, SAS code and results for Phase I to IV trials and BA/BE studies: one-sample and two-sample tests, parallel and 2x2 crossover designs, and partial and full replicate designs, including reference-scaled bioequivalence by simulation.

Sample size is the first statistical question in any clinical study, from a Phase I bioequivalence study to a Phase III confirmatory trial, and it is too often answered with a rule of thumb. A study that is too small fails even when the treatment works or the products are equivalent; one that is too large exposes participants unnecessarily and wastes budget.

This article covers sample size calculation for the designs used across Phase I to IV trials and BA/BE studies, each with the formula, SAS code, the result and how to interpret it: one-sample tests for a mean and a proportion (single-arm trials), two-sample comparisons (parallel-group trials, including parallel bioequivalence), the 2×2 crossover, and partial and fully replicated designs for both conventional and reference-scaled bioequivalence.

The inputs every calculation needs

InputMeaningTypical value in BA/BE
Significance level (α)Accepted risk of a false positive conclusion0.05 for each one-sided test (giving the 90% confidence interval)
Power (1 − β)Probability the study succeeds when the assumption is true80% or 90%
VariabilityStandard deviation, or within-subject CV for crossover studiesFrom a pilot study or the literature
Expected effectDifference to detect, or the assumed test/reference ratioRatio of 0.95 (0.90 for highly variable drugs)
LimitsEquivalence limits, when the aim is to show equivalence0.80 to 1.25

Two points apply throughout. First, assuming a ratio of exactly 1.00 is optimistic: products are never identical, and sample size rises sharply as the assumed ratio moves away from 1. Second, the calculated number is the number of subjects who must complete the study, so it must be increased for expected dropouts.

Statistical concepts

1. Superiority and equivalence are different problems

A superiority test asks whether a difference exists; the sample size depends on the size of the difference to detect. A bioequivalence test asks whether the difference is small enough; it uses two one-sided tests (TOST), and the sample size depends on how close the assumed ratio is to the equivalence limits.

2. The normal approximation and the t distribution

The textbook formula n = ((z1−α/2 + z1−β) · σ / δ)2 uses the normal distribution. Because the variance is estimated from the data, the test actually uses the t distribution, and the exact calculation (based on the noncentral t distribution) gives a slightly larger number. SAS PROC POWER performs the exact calculation.

3. Log scale and the within-subject CV

Bioequivalence is assessed on log-transformed data. The within-subject variance on the log scale is obtained from the CV by σ2W = ln(CV2 + 1). A CV of 30% corresponds to σW = 0.294.

4. Design constants

For average bioequivalence, the standard error of the treatment difference is √(k · σ2W / N), where N is the total number of subjects and k depends on the design. Replicating treatments reduces k, which is why replicate designs need fewer subjects.

DesignSequencesPeriodsDesign constant (k)Degrees of freedom
2×2 crossoverTR / RT22N − 2
Partial replicateTRR / RTR / RRT31.52N − 3
Full replicateTRTR / RTRT413N − 4

5. Power of the two one-sided tests

Power is the probability that both one-sided tests reject. It is calculated from the noncentral t distribution with noncentrality parameters (ln θ0 − ln 0.80) / SE and (ln θ0 − ln 1.25) / SE, where θ0 is the assumed ratio. The sample size is the smallest N, in multiples of the number of sequences, at which power reaches the target.

6. Reference-scaled bioequivalence needs simulation

For highly variable drugs assessed with the FDA reference-scaled method, the acceptance limits depend on the estimated variability, and the decision also includes a point estimate constraint and a switch to the unscaled method below sWR = 0.294. No closed formula exists, so power is estimated by simulation.

1. One-sample test for a mean

Use: comparing a single group with a fixed reference value, for example mean change from baseline against zero.

Example: detect a mean of 5 units against a null value of 0, standard deviation 10, two-sided α = 0.05, power 90%.

proc power;
   onesamplemeans test      = t
                  nullmean  = 0
                  mean      = 5
                  stddev    = 10
                  alpha     = 0.05
                  sides     = 2
                  power     = 0.90
                  ntotal    = .;
run;

Result: N = 44 (actual power 0.900). The normal approximation gives 42.03, which would round to 43; the exact t-based calculation needs one more subject.

2. One-sample test for a proportion

Use: comparing a response rate with a fixed benchmark.

Example: show a response rate of 65% against a benchmark of 50%, two-sided α = 0.05, power 80%.

proc power;
   onesamplefreq test           = z
                 method         = normal
                 nullproportion = 0.50
                 proportion     = 0.65
                 alpha          = 0.05
                 sides          = 2
                 power          = 0.80
                 ntotal         = .;
run;

Result: N = 85 (actual power 0.801). The formula is n = ((z1−α/2√(p0q0) + z1−β√(p1q1)) / (p1 − p0))2 = 84.8. For small samples or proportions near 0 or 1, use the exact binomial test instead (METHOD=EXACT).

3. Two-sample comparisons

3a. Difference between two means

Example: detect a difference of 5 units between two parallel groups, standard deviation 12, two-sided α = 0.05, power 90%.

proc power;
   twosamplemeans test      = diff
                  meandiff  = 5
                  stddev    = 12
                  alpha     = 0.05
                  sides     = 2
                  power     = 0.90
                  npergroup = .;
run;

Result: 123 per group, 246 in total (actual power 0.902).

3b. Difference between two proportions

Example: detect response rates of 60% and 75%, two-sided α = 0.05, power 80%.

proc power;
   twosamplefreq test             = pchi
                 groupproportions = (0.60 0.75)
                 alpha            = 0.05
                 sides            = 2
                 power            = 0.80
                 npergroup        = .;
run;

Result: 152 per group, 304 in total (actual power 0.800).

3c. Parallel-group bioequivalence

Use: drugs with a very long half-life, or patient studies, where a crossover is impractical. Each subject receives only one product, so the calculation uses the total (between-subject plus within-subject) CV, which is much larger than the within-subject CV.

Example: total CV 35%, assumed ratio 0.95, limits 0.80 to 1.25, power 80%.

proc power;
   twosamplemeans test      = equiv_ratio
                  dist      = lognormal
                  lower     = 0.80
                  upper     = 1.25
                  meanratio = 0.95
                  cv        = 0.35
                  alpha     = 0.05
                  power     = 0.80
                  npergroup = .;
run;

Result: 51 per group, 102 in total. For 90% power the requirement is 69 per group, 138 in total.

4. Crossover and replicate designs for average bioequivalence

The macro below calculates the sample size for the 2×2 crossover, the partial replicate and the full replicate design using the design constants and the noncentral t distribution. It increases N in steps of the number of sequences, so the result is always balanced.

%macro be_n(design=2x2, cv=0.30, theta0=0.95, power=0.80,
            alpha=0.05, lower=0.80, upper=1.25);

   data be_n;
      length design $6;
      design = "&design";
      cv     = &cv;
      theta0 = &theta0;
      target = &power;

      sw2 = log(cv**2 + 1);              /* within-subject variance, log scale */

      /* Design constant and step size (number of sequences) */
      if      design = '2x2'   then do;  k = 2;    step = 2;  end;
      else if design = '2x3x3' then do;  k = 1.5;  step = 3;  end;
      else if design = '2x2x4' then do;  k = 1;    step = 2;  end;

      do n = 2*step to 3000 by step;

         if      design = '2x2'   then df = n - 2;
         else if design = '2x3x3' then df = 2*n - 3;
         else if design = '2x2x4' then df = 3*n - 4;

         se    = sqrt(k * sw2 / n);
         tcrit = tinv(1 - &alpha, df);
         ncp1  = (log(theta0) - log(&lower)) / se;
         ncp2  = (log(theta0) - log(&upper)) / se;

         /* Power of the two one-sided tests */
         power = probt(-tcrit, df, ncp2) - probt(tcrit, df, ncp1);

         if power ge target then leave;
      end;

      keep design cv theta0 target n power;
   run;

   proc print data=be_n noobs;
      format power 6.4;
   run;

%mend be_n;

%be_n(design=2x2,   cv=0.30);     /* 2x2 crossover      */
%be_n(design=2x3x3, cv=0.30);     /* partial replicate  */
%be_n(design=2x2x4, cv=0.30);     /* full replicate     */

Result for a within-subject CV of 30%, ratio 0.95, power 80%

DesignSubjects (N)Achieved powerTotal treatment administrations
2×2 crossover400.815880
Partial replicate (3 periods)300.820490
Full replicate (4 periods)200.820280

Sample size by within-subject CV (ratio 0.95, limits 0.80 to 1.25)

CV2×2, 80%2×2, 90%Partial, 80%Partial, 90%Full, 80%Full, 90%
15%121691268
20%202615181012
25%283821301420
30%405230392026
35%527039542636
40%668851663444

These are statistical minimums. Regulators generally expect at least 12 evaluable subjects in any bioequivalence study, so the smallest values in the table should be raised to that minimum.

5. Replicate designs with reference-scaled bioequivalence

For highly variable drugs, replicate designs are used with the FDA reference-scaled method. Power is estimated by simulating the three statistics the method relies on: the point estimate, its variance, and the within-subject variance of the reference. Under the usual assumptions these are independent, so they can be generated directly without simulating individual subjects.

%macro rsabe_power(design=2x2x4, n=24, cv=0.40, theta0=0.90,
                   nsim=200000, seed=20261118);

   data rsabe_sim;
      call streaminit(&seed);

      sw2   = log(&cv**2 + 1);               /* within-subject variance      */
      theta = (log(1.25) / 0.25)**2;          /* regulatory constant          */

      /* Variance of the subject-level T - R contrast, and degrees of freedom */
      %if &design = 2x3x3 %then %do;
         vi = 1.5 * sw2;   df = &n - 3;       /* partial replicate            */
      %end;
      %else %do;
         vi = sw2;         df = &n - 2;       /* full replicate               */
      %end;

      tcrit = tinv(0.95, df);
      chi   = cinv(0.95, df);

      do sim = 1 to ≁

         pe   = rand('normal', log(&theta0), sqrt(vi / &n));   /* point estimate */
         s2i  = vi  * rand('chisquare', df) / df;                  /* its variance   */
         s2wr = sw2 * rand('chisquare', df) / df;                  /* reference s2WR */

         se = sqrt(s2i / &n);
         lo = pe - tcrit * se;
         up = pe + tcrit * se;

         /* 95% upper bound of the linearised criterion */
         x      = pe**2 - se**2;
         boundx = max(abs(lo), abs(up))**2;
         y      = -theta * s2wr;
         boundy = y * df / chi;
         crit   = x + y + sqrt((boundx - x)**2 + (boundy - y)**2);

         if sqrt(s2wr) ge 0.294 then          /* reference-scaled criterion   */
            pass = (crit le 0 and log(0.80) le pe le log(1.25));
         else                                 /* unscaled criterion           */
            pass = (lo ge log(0.80) and up le log(1.25));

         output;
      end;

      keep pass;
   run;

   title "RSABE power: design &design, N=&n, CV=&cv, ratio=&theta0";
   proc means data=rsabe_sim mean maxdec=4;
      var pass;
   run;
   title;

%mend rsabe_power;

%rsabe_power(design=2x2x4, n=24, cv=0.40);    /* full replicate    */
%rsabe_power(design=2x3x3, n=33, cv=0.40);    /* partial replicate */

Run the macro for increasing N until the mean of PASS reaches the target power.

Result for a CV of 40%, ratio 0.90, power 80%

DesignSubjects (N)Simulated power
Full replicate (TRTR / RTRT)240.806
Partial replicate (TRR / RTR / RRT)330.808

Reference-scaled sample size by CV (ratio 0.90)

CVPartial, 80%Partial, 90%Full, 80%Full, 90%
30%45663244
35%39512838
40%33452434
45%33452432
50%30452232
60%33572438

Values are from simulation and can change by one step with a different seed. The FDA expects at least 24 subjects in a replicate study intended for reference scaling, so values below 24 should be raised to 24.

6. Adjusting for dropouts

Divide the required number of completers by the expected completion rate and round up to a multiple of the number of sequences.

data dropout;
   n_complete   = 40;          /* from the sample size calculation */
   dropout_rate = 0.15;        /* expected proportion not completing */
   n_sequences  = 2;

   n_raw   = n_complete / (1 - dropout_rate);
   n_enrol = ceil(n_raw / n_sequences) * n_sequences;
run;

proc print data=dropout noobs;
run;

Result: 40 / 0.85 = 47.1, rounded up to 48 subjects to enrol. Longer designs lose more subjects: allow a higher dropout rate for three- and four-period studies than for a two-period study.

Interpretation

  1. The exact calculation matters. For the one-sample mean, the normal approximation gives 43 and the exact calculation 44. The gap is small here but grows as the sample size falls, which is exactly the range in which BA/BE studies operate.
  2. Parallel designs are expensive. With a total CV of 35%, a parallel bioequivalence study needs 102 subjects. A crossover removes between-subject variability, which is why it is the default whenever the half-life allows.
  3. Variability drives everything. In a 2×2 crossover, raising the within-subject CV from 20% to 30% doubles the sample size from 20 to 40, and 40% needs 66. An accurate CV estimate is worth more than any refinement of the method.
  4. Replication trades subjects for periods. At a CV of 30%, the full replicate needs 20 subjects against 40 for the 2×2 design, but each subject is dosed four times, so the number of administrations is the same (80). The partial replicate needs 30 subjects and 90 administrations. Replicate designs reduce recruitment, not clinical workload, and they increase the time each subject spends in the study.
  5. Reference scaling changes the pattern. Under average bioequivalence the sample size keeps rising with CV. Under reference scaling it is roughly flat: 24 subjects in a full replicate design are enough at a CV of 40%, where the unscaled approach would need 34 even with the more favourable ratio of 0.95. This is the practical benefit of scaling.
  6. The borderline is the hard case. The largest reference-scaled sample sizes are at a CV of 30%, where the study may fall on either side of the 0.294 switch and little widening is available. At very high CVs the point estimate constraint starts to limit power, which is why the numbers rise again at 60%.
  7. Full replicate is more efficient than partial. For reference scaling at a CV of 40%, the full replicate needs 24 subjects and the partial replicate 33. The full replicate also allows the within-subject variability of the test product to be estimated.

The assumed ratio is the most sensitive input. In a 2×2 crossover with a CV of 25%, assuming a ratio of 0.95 gives 28 subjects; assuming 0.90 gives 56. Halving the distance to the limit doubles the study. If the pilot data do not clearly support 0.95, plan for the less favourable value.

Practical points

  • Source of the CV. Use the within-subject CV from a pilot study, a previous study of the same product, or published data. Pilot estimates are imprecise; consider using the upper confidence limit of the CV, not the point estimate.
  • Calculate for every primary parameter. Cmax usually has the highest variability and determines the sample size, but check AUC as well.
  • Power above 90% may be questioned. Ethics committees and regulators can object to studies that are much larger than needed. A target of 80% to 90% is standard.
  • Two-stage designs. When the CV is very uncertain, a two-stage adaptive design re-estimates the sample size at an interim analysis with an adjusted significance level.
  • Document the calculation. The protocol should state the design, CV and its source, assumed ratio, limits, α, power, software and the dropout allowance.

References

  • US FDA. Bioequivalence Studies With Pharmacokinetic Endpoints for Drugs Submitted Under an ANDA, Draft Guidance for Industry.
  • US FDA. Statistical Approaches to Establishing Bioequivalence, Guidance for Industry. 2001.
  • Schuirmann DJ. A comparison of the two one-sided tests procedure and the power approach for assessing the equivalence of average bioavailability. Journal of Pharmacokinetics and Biopharmaceutics. 1987;15(6):657–680.
  • Julious SA. Sample sizes for clinical trials with normal data. Statistics in Medicine. 2004;23(12):1921–1986.
  • Chow SC, Liu JP. Design and Analysis of Bioavailability and Bioequivalence Studies. 3rd edition. Chapman and Hall/CRC; 2008.

The examples in this article use assumed values and are provided for training purposes only.

Found this useful?Share it with your team or network.

Need help applying this to your study?

Our statisticians, programmers and quality specialists can review it with you.