The PSMATCH Procedure
Example 95.2 Propensity Score Stratification
(View the complete code for this example.)
This example creates strata of observations that are based on propensity scores for patients in the trial in a propensity score analysis. The Drugs data set contains the patient information and is described in the section Getting Started: PSMATCH Procedure.
The following statements invoke the PSMATCH procedure and create five strata that are based on propensity scores:
ods graphics on;
proc psmatch data=drugs region=allobs;
class Drug Gender;
psmodel Drug(Treated='Drug_X')= Gender Age Bmi;
strata nstrata=5;
assess ps var=(Gender Age Bmi)
/ varinfo plots=(boxplot barchart);
output out(obs=all)=OutEx2;
run;
The CLASS statement specifies the classification variables. The PSMODEL statement specifies the logistic regression model that creates the propensity score for each observation, which is the probability that the patient receives Drug_X. The Drug variable is the binary treatment indicator variable, and TREATED='Drug_X' identifies Drug_X as the treated group. The Gender, Age, and Bmi variables are included in the model because they are believed to be related to the assignment.
The REGION= option specifies an interval region of propensity scores such that only observations that have propensity scores in the region are used in stratification and matching. You can also use the REGION= option to select observations in the region to compare variable differences between observations in the treatment and control groups. The REGION=ALLOBS option selects all available observations.
The STRATA statement creates strata of observations based on propensity scores. The NSTRATA=5 option (which is the default) stratifies observations in the support region into five strata.
The "Data Information" table in Output 95.2.1 displays information about the input and output data sets, the numbers of observations in the treated and control groups, the lower and upper limits for the propensity score support region, and the numbers of observations in the treated and control groups that fall within the support region. Note that because REGION=ALLOBS, all 373 observations in the control group fall within the support region.
Output 95.2.1: Data Information
| Data Information | |
|---|---|
| Data Set | WORK.DRUGS |
| Output Data Set | WORK.OUTEX2 |
| Treatment Variable | Drug |
| Treatment Group | Drug_X |
| All Obs (Treatment) | 113 |
| All Obs (Control) | 373 |
| Support Region | All Obs |
| Lower PS Support | 0.020157 |
| Upper PS Support | 0.685757 |
| Support Region Obs (Treatment) | 113 |
| Support Region Obs (Control) | 373 |
| Number of Strata | 5 |
The "Propensity Score Information" table in Output 95.2.2 displays summary statistics by treatment group for all observations and for the support region observations.
Output 95.2.2: Propensity Score Information
When you specify a STRATA statement, the "Strata Information" table in Output 95.2.3 displays the minimum and maximum propensity scores, the total number of treated observations, and the total number of controls in each stratum.
Output 95.2.3: Strata Information
The ASSESS statement produces the tables and plots that summarize differences in the specified variables between treated and control groups for all observations, for the support region observations, and for the matched observations. As requested by the PS and VAR= options, the variables listed in the table are the propensity score and the variables Gender, Age, and Bmi. When you specify a STRATA statement, WEIGHT=NONE by default, suppressing display of differences for the weighted observations.
The VARINFO option displays the "Variable Information" table, which contains variable differences between the treated and control groups for all observations and for the support region observations, as shown in Output 95.2.4. For a binary classification variable (Gender), the difference is in the proportion of the first ordered level (Female).
Output 95.2.4: Variable Information
| Variable Information | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Variable | Observations | Treated (Drug = Drug_X) | Control (Drug = Drug_A) | ||||||||
| N | Mean | Std Dev | Minimum | Maximum | N | Mean | Std Dev | Minimum | Maximum | ||
| PS | All | 113 | 0.310773 | 0.132467 | 0.060231 | 0.641148 | 373 | 0.208801 | 0.131969 | 0.020157 | 0.685757 |
| Region | 113 | 0.310773 | 0.132467 | 0.060231 | 0.641148 | 373 | 0.208801 | 0.131969 | 0.020157 | 0.685757 | |
| Age | All | 113 | 36.309735 | 5.534114 | 26.000000 | 49.000000 | 373 | 40.404826 | 6.579103 | 25.000000 | 57.000000 |
| Region | 113 | 36.309735 | 5.534114 | 26.000000 | 49.000000 | 373 | 40.404826 | 6.579103 | 25.000000 | 57.000000 | |
| Bmi | All | 113 | 24.492566 | 1.863797 | 20.330000 | 28.340000 | 373 | 23.753271 | 1.980778 | 19.220000 | 28.610000 |
| Region | 113 | 24.492566 | 1.863797 | 20.330000 | 28.340000 | 373 | 23.753271 | 1.980778 | 19.220000 | 28.610000 | |
| Gender | All | 113 | 0.433628 | 0.495575 | 373 | 0.458445 | 0.498270 | ||||
| Region | 113 | 0.433628 | 0.495575 | 373 | 0.458445 | 0.498270 | |||||
When REGION=ALLOBS, the statistics are identical between all observations and the support region observations.
The "Standardized Variable Differences" table in Output 95.2.5 displays the standardized differences between the treated and control groups for all observations and for the support region observations,
Output 95.2.5: Standardized Differences
| Standardized Variable Differences (Treated - Control) | ||||||||
|---|---|---|---|---|---|---|---|---|
| Variable | Standardized Mean Difference | |||||||
| Mean Difference | Divisor | Mean Difference | Percent Reduction | Variance Ratio | ||||
| All Obs | Region Obs | All Obs | Region Obs | Region Obs | All Obs | Region Obs | ||
| PS | 0.101972 | 0.101972 | 0.132218 | 0.771242 | 0.771242 | 0.00 | 1.0076 | 1.0076 |
| Age | -4.095091 | -4.095091 | 6.079104 | -0.673634 | -0.673634 | 0.00 | 0.7076 | 0.7076 |
| Bmi | 0.739296 | 0.739296 | 1.923178 | 0.384414 | 0.384414 | 0.00 | 0.8854 | 0.8854 |
| Gender | -0.024817 | -0.024817 | 0.496925 | -0.049941 | -0.049941 | 0.00 | 0.9892 | 0.9892 |
When ODS Graphics is enabled, the PLOTS option displays plots for the specified variables. The plots without strata information are not shown here because the REGION=ALLOBS option results in all observations being in the support region.
When you specify a STRATA statement, the ASSESS statement also produces tables and plots that summarize differences in the specified variables between treated and control groups by stratum.
The VARINFO option in the ASSESS statement displays the variable information of the treated and control groups for observations in each stratum, as shown in Output 95.2.6.
Output 95.2.6: Strata Variable Information
| Strata Variable Information Region Observations | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Variable | Stratum Index | Treated (Drug = Drug_X) | Control (Drug = Drug_A) | ||||||||
| N | Mean | Std Dev | Minimum | Maximum | N | Mean | Std Dev | Minimum | Maximum | ||
| PS | 1 | 22 | 0.140401 | 0.041360 | 0.060231 | 0.194358 | 209 | 0.115891 | 0.043859 | 0.020157 | 0.194132 |
| 2 | 23 | 0.221993 | 0.019418 | 0.196742 | 0.259357 | 59 | 0.228211 | 0.018395 | 0.197342 | 0.261300 | |
| 3 | 23 | 0.299861 | 0.018811 | 0.263497 | 0.322300 | 38 | 0.294568 | 0.017541 | 0.261861 | 0.321559 | |
| 4 | 23 | 0.380869 | 0.026077 | 0.326680 | 0.434184 | 41 | 0.370552 | 0.030646 | 0.325937 | 0.434208 | |
| 5 | 22 | 0.512086 | 0.058200 | 0.437927 | 0.641148 | 26 | 0.531182 | 0.071893 | 0.441204 | 0.685757 | |
| Age | 1 | 22 | 42.909091 | 4.150836 | 35.000000 | 49.000000 | 209 | 44.449761 | 4.811706 | 32.000000 | 57.000000 |
| 2 | 23 | 37.652174 | 3.938259 | 29.000000 | 44.000000 | 59 | 38.254237 | 4.305543 | 29.000000 | 47.000000 | |
| 3 | 23 | 36.565217 | 3.870942 | 29.000000 | 43.000000 | 38 | 35.421053 | 3.636389 | 27.000000 | 43.000000 | |
| 4 | 23 | 33.695652 | 4.247296 | 26.000000 | 41.000000 | 41 | 34.219512 | 3.086359 | 29.000000 | 41.000000 | |
| 5 | 22 | 30.772727 | 2.827279 | 27.000000 | 35.000000 | 26 | 29.807692 | 2.939649 | 25.000000 | 37.000000 | |
| Bmi | 1 | 22 | 23.500909 | 1.751203 | 20.330000 | 26.110000 | 209 | 23.175407 | 1.917237 | 19.240000 | 27.850000 |
| 2 | 23 | 23.653043 | 1.794401 | 20.430000 | 26.660000 | 59 | 23.878475 | 1.951062 | 19.220000 | 27.680000 | |
| 3 | 23 | 24.707826 | 1.764444 | 20.850000 | 27.560000 | 38 | 24.108158 | 1.698325 | 20.240000 | 27.600000 | |
| 4 | 23 | 24.915217 | 1.950177 | 20.980000 | 28.340000 | 41 | 24.935854 | 1.484916 | 22.370000 | 28.290000 | |
| 5 | 22 | 25.695000 | 1.130338 | 23.320000 | 28.060000 | 26 | 25.730769 | 1.337953 | 23.410000 | 28.610000 | |
| Gender | 1 | 22 | 0.454545 | 0.497930 | 209 | 0.507177 | 0.499948 | ||||
| 2 | 23 | 0.565217 | 0.495728 | 59 | 0.322034 | 0.467256 | |||||
| 3 | 23 | 0.391304 | 0.488042 | 38 | 0.447368 | 0.497222 | |||||
| 4 | 23 | 0.434783 | 0.495728 | 41 | 0.390244 | 0.487805 | |||||
| 5 | 22 | 0.318182 | 0.465770 | 26 | 0.500000 | 0.500000 | |||||
The "Strata Standardized Variable Differences" table in Output 95.2.7 displays the variable differences, standardized differences, reduction percentages, and ratios of variances for observations in each stratum. The standardized difference is the variable difference divided by the divisor (which is displayed in the "Standardized Variable Differences" table in Output 95.2.5), and the reduction percentage compares the standardized difference with the standardized difference of all observations.
Output 95.2.7: Strata Standardized Differences
| Strata Standardized Variable Differences (Treated - Control) Region Observations | |||||
|---|---|---|---|---|---|
| Variable | Stratum Index | Mean Difference | Standardized Difference | Percent Reduction | Variance Ratio |
| PS | 1 | 0.024509 | 0.185370 | 75.96 | 0.889269 |
| 2 | -0.006219 | -0.047033 | 93.90 | 1.114307 | |
| 3 | 0.005293 | 0.040035 | 94.81 | 1.149989 | |
| 4 | 0.010317 | 0.078030 | 89.88 | 0.724072 | |
| 5 | -0.019096 | -0.144430 | 81.27 | 0.655343 | |
| Age | 1 | -1.540670 | -0.253437 | 62.38 | 0.744171 |
| 2 | -0.602063 | -0.099038 | 85.30 | 0.836667 | |
| 3 | 1.144165 | 0.188213 | 72.06 | 1.133163 | |
| 4 | -0.523860 | -0.086174 | 87.21 | 1.893792 | |
| 5 | 0.965035 | 0.158746 | 76.43 | 0.925010 | |
| Bmi | 1 | 0.325502 | 0.169252 | 55.97 | 0.834299 |
| 2 | -0.225431 | -0.117218 | 69.51 | 0.845857 | |
| 3 | 0.599668 | 0.311811 | 18.89 | 1.079380 | |
| 4 | -0.020636 | -0.010730 | 97.21 | 1.724822 | |
| 5 | -0.035769 | -0.018599 | 95.16 | 0.713731 | |
| Gender | 1 | -0.052632 | -0.105915 | 0.00 | 0.991940 |
| 2 | 0.243183 | 0.489377 | 0.00 | 1.125585 | |
| 3 | -0.056064 | -0.112822 | 0.00 | 0.963416 | |
| 4 | 0.044539 | 0.089629 | 0.00 | 1.032750 | |
| 5 | -0.181818 | -0.365887 | 0.00 | 0.867769 | |
When ODS Graphics is enabled, the strata standardized differences for the specified variables are displayed, as shown in Output 95.2.8.
Output 95.2.8: Strata Standardized Differences Plot

The "Strata Standardized Variable Differences Plot" displays the standardized differences in the "Strata Standardized Variable Differences" table in Output 95.2.7. The plot shows larger differences in Stratum 2 and Stratum 5 for Gender.
The PLOTS=BOXPLOT option displays a strata variable box plot for each continuous variable, as shown in Output 95.2.9 for PS, Output 95.2.10 for Age, and Output 95.2.11 for Bmi. The box plots show reasonably good variable balance in each stratum.
Output 95.2.9: PS Strata Box Plot

Output 95.2.10: Age Strata Box Plot

Output 95.2.11: Bmi Strata Box Plot

PLOTS=BARCHART displays a strata variable bar chart for each classification variable, as shown in Output 95.2.12 for Gender. The bar chart shows differences in the female and male relative frequencies between the treated and control groups in Stratum 2 and Stratum 5.
Output 95.2.12: Gender Strata Bar Chart

If you are not satisfied with the variable balance, you can do one or more of the following until you are satisfied: you can select another set of variables to fit the propensity score model, you can modify the specification of the propensity score model (for instance, by using nonlinear terms for the continuous variables or by adding interactions), you can increase the number of strata, or you can choose another propensity score method (such as matching).
The OUT(OBS=ALL)=OutEx2 option in the OUTPUT statement creates an output data set, OutEx2, that contains all observations. The following statements list the first 10 observations in OutEx2, as shown in Output 95.2.13:
proc print data=OutEx2(obs=10); var PatientID Drug Gender Age Bmi _ps_ _Strata_; run;
Output 95.2.13: Output Data Set with Strata
| Obs | PatientID | Drug | Gender | Age | Bmi | _PS_ | _STRATA_ |
|---|---|---|---|---|---|---|---|
| 1 | 284 | Drug_X | Male | 29 | 22.02 | 0.36444 | 4 |
| 2 | 201 | Drug_A | Male | 45 | 26.68 | 0.22296 | 2 |
| 3 | 147 | Drug_A | Male | 42 | 21.84 | 0.11323 | 1 |
| 4 | 307 | Drug_X | Male | 38 | 22.71 | 0.19733 | 2 |
| 5 | 433 | Drug_A | Male | 31 | 22.76 | 0.35311 | 4 |
| 6 | 435 | Drug_A | Male | 43 | 26.86 | 0.27263 | 3 |
| 7 | 159 | Drug_A | Female | 45 | 25.47 | 0.14911 | 1 |
| 8 | 368 | Drug_A | Female | 49 | 24.28 | 0.07780 | 1 |
| 9 | 286 | Drug_A | Male | 31 | 23.31 | 0.38341 | 4 |
| 10 | 163 | Drug_X | Female | 39 | 25.34 | 0.24995 | 2 |
By default, the output data set includes the variable _PS_ (which provides the propensity score) and the variable _STRATA_ (which provides stratum indices).
If you assume that no other confounding variables are associated with both the response variable and the treatment group indicator Drug, then after the responses for the trial are observed and added to the data set OutEx2, you can estimate the treatment effect within each stratum and combine these estimates across strata to estimate the treatment effect (Stuart 2010, pp. 13–14).
Copyright © SAS Institute Inc. All rights reserved.