SAS Macro for Charting the Relative Costs of Reduced Factorial Designs

Our software resources are permanently archived at Our software is no longer supported by the Help Desk. For the latest software and research updates, visit Linda Collins’ website.


SAS Macro
Sample File 1: Example 1 for Using the Macro
Sample File 2: Example 2 for Using the Macro

The SAS macro RelativeCosts1 is provided as a supplement to Collins, Dziak, & Li (2009).

It automates the calculation and graphing of relative costs of implementing different designs for multiple-factor experimental designs for screening or testing the effects of several independent dichotomous factors. It is written for use with SAS 9.1 for Windows.

Read more information about factorial experimental designs and the multiphase optimization stragetgy (MOST).

Sample File 1 can be run to demonstrate its use in a situation in which per-condition overhead costs are expected to be greater than per-subject marginal costs, and Sample File 2 demonstrates its use in the opposite situation.

Before using the macro, you must tell SAS where you have saved the file, e.g.,



To use the macro, call it using the syntax below, replacing the “???”’s with the appropriate values.

%RelativeCosts1( number_of_factors=???,






max_graph_ratio=???) ;


The meaning of the arguments are listed below.

  • Number_of_factors should be an integer between 2 and 19, telling the number k of factors of interest.
  • Desired_fract_resolution should be an integer between 3 and 6, giving the desired resolution of the fractional factorial design to be considered.
  • Min_target_d_per_factor is the effect size for which a power of .80 to detect is desired. This effect size refers to the main effect for a full or fractional factorial design, or to the appropriate simple effect in a single-factor-many-levels or many-separate-experiments design.
  • Condition_costlier_than_subject should be 0 if the per-condition overhead cost is expected to be less than the per-subject cost (e.g., if the cost of a treatment level is $500 plus $5000 per subject) and 1 if it is expected to be greater (e.g., if the cost of a treatment level is $5000 plus $500 per subject).
  • Max_cost_ratio, num_graph_points, and max_graph ratio control aspects of the appearance of the graph. These arguments can often be omitted, in which case they are left at sensible default levels.

The macro prints information such as the following to the output window.

Doing separate experiments on each of the 9 factors requires at least:

7074 subjects total, i.e. 393 subjects in each of 18 cells.

A comparative setup with 9 groups plus a control group requires at least:

3930 subjects total, i.e. 393 subjects in each of 10 cells.

A 2^9 complete factorial experiment requires at least:

1024 subjects total, i.e. 2 subjects in each of 512 cells.

A resolution 4 fractional factorial experiment with 9 factors requires at least:

800 subjects total, i.e. 25 subjects in each of 32 cells


The macro also produces a graph showing the relative costs of each design as a function of the ratio of per-condition overhead cost to per-subject cost (if condition_costlier_than_subject = 1) or per-subject cost to per-condition overhead cost (if condition_costlier_than_subject = 0). The ratios considered are 0 to max_cost_ratio, where the latter has a default value of 100. This macro is free and is provided for use without any warranty, implied or otherwise.


Reference & Recommended Citation

Collins, L. M., Dziak J. J., & Li, R.  (2009). Design of experiments with multiple independent variables: A resource management perspective on complete and reduced factorial designs. Psychological Methods, 14(3), 202-24.  PMCID: PMC2796056