Proc Power in SAS 9.1
Outline
• Sample size and power calculations
• Customizing plots of power function
• ODS Tables
Statistical analysis covered in the power procedure
• t tests for means • equivalence tests for means • confidence intervals for means • tests of binomial proportions • multiple regression • tests of correlation and partial correlation • one-way analysis of variance • rank tests for comparing two survival curves
Syntax
PROC POWER < options > ; MULTREG < options > ; ONECORR < options > ; ONESAMPLEFREQ < options > ; ONESAMPLEMEANS < options > ; ONEWAYANOVA < options > ; PAIREDFREQ < options > ; PAIREDMEANS < options > ; TWOSAMPLEFREQ < options > ; TWOSAMPLEMEANS < options > ; TWOSAMPLESURVIVAL < options > ; PLOT < plot-options > < / graph-options > ;
Twosamplemeans statement
Twosamplemeans <options>; Performing power and sample size analyses for two-
independent-sample versions of pooled and unpooled t-tests, equivalence tests and confidence interval precision.
<options>: design, data analysis method, variability,
type I Error, effect size, power , sample size.
Two sample independent mean
**missing value identifies a parameter as result parameter;
Proc power; twosamplemeans test=diff dist=normal meandiff = 3 3.5 4 stddev= 8 to 9 by 0.5 groupweights = (1 2) power = 0.8 ntotal = .; plot y=power min=0.5 max=0.99;
Two-sample t Test for Mean Difference
Computed N Total
Index Mean
Diff Std Dev
Actual Power
N Total
1 3.0 8.0 0.803 255
2 3.0 8.5 0.803 288
3 3.0 9.0 0.801 321
4 3.5 8.0 0.805 189
5 3.5 8.5 0.805 213
6 3.5 9.0 0.803 237
7 4.0 8.0 0.802 144
8 4.0 8.5 0.801 162
9 4.0 9.0 0.805 183
Fixed Scenario Elements
Distribution Normal
Method Exact
Group 1 Weight 1
Group 2 Weight 2
Nominal Power 0.8
Number of Sides 2
Null Difference 0
Alpha 0.05
Two sample independent mean
Proc power; twosamplemeans meandiff = 3 3.5 4 stddev=8 to 9 by 0.5 groupweights=(1 2) power = . ntotal = 249; plot x=n min=150 max=400;run;
Two-sample t Test Fixed Scenario Elements
Distribution Normal
Method Exact
Group 1 Weight 1
Group 2 Weight 2
Total Sample Size 249
Number of Sides 2
Null Difference 0
Alpha 0.05
Computed Power
Index Mean
Diff Std Dev Power
1 3.0 8.0 0.794
2 3.0 8.5 0.744
3 3.0 9.0 0.695
4 3.5 8.0 0.900
5 3.5 8.5 0.862
6 3.5 9.0 0.822
7 4.0 8.0 0.959
8 4.0 8.5 0.937
9 4.0 9.0 0.909
Twosamplefreq statement
Twosamplefreq <options>;
Do power and sample size analyses for tests of two independent proportions. Pearson’s chi-square, Fisher’s exact, and likelihood ratio chi-square tests are supported.
Fisher’s Exact Test
Proc power; Twosamplefreq test=fisher Proportiondiff = 0.10 to 0.15 by 0.01 Refproportion = 0.20 npergroup= . Power = 0.85; plot y=power min=0.5 max=0.99;Run;
Fisher's Exact Conditional Test for Two Proportions
Fixed Scenario Elements
Distribution Exact conditional
Method Walters normal approximation
Reference (Group 1) Proportion 0.2
Nominal Power 0.85
Number of Sides 2
Alpha 0.05
Computed N Per Group
Index Proportion
Diff Actual Power
N Per Group
1 0.10 0.850 354
2 0.11 0.851 298
3 0.12 0.851 254
4 0.13 0.851 220
5 0.14 0.852 193
6 0.15 0.851 170
Twosamplesurvival Statement
Twosamplesurvival <options>;
Power and sample size analyses for comparing two survival curves by the log-rank, Gehan, and Tarone-Ware rank tests.
Survival analysis
proc power; twosamplesurvival test = logrank groupmedsurtimes = (16 22) accrualtime = 6 totaltime = 18 groupns = 40 | 60 power = . ;run;
Log-Rank Test for Two Survival Curves
Fixed Scenario Elements
Method Lakatos normal approximation
Form of Survival Curve 1 Exponential
Form of Survival Curve 2 Exponential
Accrual Time 6
Total Time 18
Group 1 Median Survival Time 16
Group 2 Median Survival Time 22
Group 1 Sample Size 40
Group 2 Sample Size 60
Number of Sides 2
Number of Time Sub-Intervals 12
Group 1 Loss Exponential Hazard 0
Group 2 Loss Exponential Hazard 0
Alpha 0.05
Computed Power
Power
0.178
Customizing Plots
Adding reference lines
Axis Options in Plot statement:• XOPTS: specify plot characteristics pertaining to
the x-axis. - REF=number-list : specifies locations for reference
lines extending from the x-axis across the entire plotting region.
-CROSSREF=YES or NO: specifies whether the reference lines defined by REF should be crossed with a reference line on y-axis that indicates the solution point on the curve.
• YOPTS
Adding reference lines
*add reference lines to highlight power=0.8 and power=0.9;
Proc power plotonly;
twosamplemeans
meandiff = 3 4
stddev=8 9
power = .
ntotal = 100;
plot x=n min=20 max=500 yopts=(ref=0.8 0.9);
run;
plot x=n min=20 max=500 yopts=(ref=0.8 0.9)
yopts=(ref=0.8 0.9 crossref=yes)
yopts=(ref=0.9) xopts=(ref=100 crossref=yes)
Linking plot features to parameters
Vary (feature <by parameter-list>... Feature <by parameter-list>
Specify how plot features should be linked to
Varying analysis parameters.
Available features are color, linestyle, panel and symbol.
Linking plot features to parameters
Proc power plotonly; twosamplemeans meandiff = 3 4 stddev=8 9 power = 0.9 ntotal = .; plot y=power min=0.5 max=0.95;run;
vary (linestyle by meandiff, symbol by stddev)
vary (symbol by meandiff, color by stddev);
Choosing Legend Styles using“Key” option
Proc power plotonly;
twosamplemeans
meandiff = 3 4
stddev=8 9
power = 0.9
ntotal = .;
plot y=power min=0.5 max=0.95 key = bycurve;
run;
key = byfeature
key = byfeature (pos=inset)
key = bycurve
key = bycurve (numbers=off pos=inset)
key = oncurves
ODS Tables
ODS tables
• FixedElements: including all single-value
Analysis parameters
• Output: showing all input and computed analysis parameters, error descriptions
• PlotContent: data contained in plots including analysis and parameters and indices identifying plot features
ODS path names
• The ODS path names are created as follows.
- Power.<analysis statement name>.FixedElements
- Power.<analysis statement name>.Output
- Power.<analysis statement name>.PlotContent