The PSMATCH Procedure
Example 95.1 Propensity Score Weighting
(View the complete code for this example.)
This example creates observation weights for all patients in the trial of 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 observation weights that are appropriate to estimate the average treatment effect for the treated (ATT):
ods graphics on;
proc psmatch data=drugs region=allobs;
class Drug Gender;
psmodel Drug(Treated='Drug_X')= Gender Age Bmi;
assess lps var=(Gender Age Bmi)
/ varinfo plots=(boxplot barchart)
weight=attwgt;
output out(obs=all)=OutEx1;
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 (or equivalently, logits of propensity scores) such that only observations that have propensity scores in the region are used in stratification and matching. Even without stratification and matching, you can still 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 "Data Information" table in Output 95.1.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. Because REGION=ALLOBS is specified, all 373 observations in the control group fall within the support region.
Output 95.1.1: Data Information
| Data Information | |
|---|---|
| Data Set | WORK.DRUGS |
| Output Data Set | WORK.OUTEX1 |
| 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 |
The "Propensity Score Information" table in Output 95.1.2 displays summary statistics by treatment group for all observations and for the support region observations. Because REGION=ALLOBS is specified, all observations are in the support region.
Output 95.1.2: Propensity Score Information
The ASSESS statement produces the tables and plots that summarize differences in the specified variables between treated and control groups for all observations and for the support region observations. As requested by the LPS and VAR= options, the variables listed in the table are the logit of propensity score and the variables Gender, Age, and Bmi. The WEIGHT=ATTWGT option also summarizes differences in the specified VAR= variables between treated and control group of differences for the weighted observations.
The "Variable Information" table in Output 95.1.3 displays variable differences between the treated and control groups for all observations and for the support region observations. With the WEIGHT=ATTWGT option, the differences for the weighted region observations are also displayed. For a binary classification variable (Gender), the difference is in the proportion of the first ordered level (Female).
Output 95.1.3: Variable Information
| Variable Information | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Variable | Observations | Treated (Drug = Drug_X) | Control (Drug = Drug_A) | ||||||||||
| N | Weight | Mean | Std Dev | Minimum | Maximum | N | Weight | Mean | Std Dev | Minimum | Maximum | ||
| LPS | All | 113 | -0.880615 | 0.681761 | -2.747444 | 0.580348 | 373 | -1.520586 | 0.844486 | -3.883858 | 0.780357 | ||
| Region | 113 | -0.880615 | 0.681761 | -2.747444 | 0.580348 | 373 | -1.520586 | 0.844486 | -3.883858 | 0.780357 | |||
| 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 | |||
| ATT Weighted Region | 113 | 113.00 | 36.309735 | 5.534114 | 26.000000 | 49.000000 | 373 | 116.59 | 35.877442 | 6.226667 | 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 | |||
| ATT Weighted Region | 113 | 113.00 | 24.492566 | 1.863797 | 20.330000 | 28.340000 | 373 | 116.59 | 24.600042 | 1.948818 | 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 | |||||||
| ATT Weighted Region | 113 | 113.00 | 0.433628 | 0.495575 | 373 | 116.59 | 0.443106 | 0.496753 | |||||
With REGION=ALLOBS, the statistics are identical between all observations and the support region observations. In addition, the statistics are also identical to weighted support region observations in the treated group, because each treated unit receives a weight of 1 when WEIGHT=ATTWGT. The total weight of the control units is 116.59, which is close to 113, the total weight of treated units. Also, the weighted variable means for support region control units are closer to the corresponding variable means for support region treated units. The statistics for the logit of propensity score are not displayed because the ATT weights for observations are computed from their propensity scores.
The "Standardized Variable Differences" table, as shown in Output 95.1.4, displays standardized differences between the treated and control groups for all observations, the support region observations, and the weighted support region observations.
Output 95.1.4: Standardized Differences
| Standardized Variable Differences (Treated - Control) | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Variable | Standardized Mean Difference | |||||||||||
| Mean Difference | Divisor | Mean Difference | Percent Reduction | Variance Ratio | ||||||||
| All Obs | Region Obs | ATT Weighted Region Obs | All Obs | Region Obs | ATT Weighted Region Obs | Region Obs | ATT Weighted Region Obs | All Obs | Region Obs | ATT Weighted Region Obs | ||
| LPS | 0.639971 | 0.639971 | 0.767448 | 0.833894 | 0.833894 | 0.00 | 0.6517 | 0.6517 | ||||
| Age | -4.095091 | -4.095091 | 0.432293 | 6.079104 | -0.673634 | -0.673634 | 0.071111 | 0.00 | 89.44 | 0.7076 | 0.7076 | 0.7899 |
| Bmi | 0.739296 | 0.739296 | -0.107476 | 1.923178 | 0.384414 | 0.384414 | -0.055884 | 0.00 | 85.46 | 0.8854 | 0.8854 | 0.9147 |
| Gender | -0.024817 | -0.024817 | -0.009478 | 0.496925 | -0.049941 | -0.049941 | -0.019073 | 0.00 | 61.81 | 0.9892 | 0.9892 | 0.9953 |
The standardized mean differences are significantly reduced in the weighted region observations; the largest of these differences is 0.0711 in absolute value, which is less than the recommended upper limit of 0.25 (Rubin 2001, p. 174; Stuart 2010, p. 11). The variance ratios between the two groups are within the recommended range of 0.5 to 2. With REGION=ALLOBS, the percentage of reduction in variable mean difference is 0 for the support region observations.
When ODS Graphics is enabled, the PSMATCH procedure displays a standardized variable differences plot for the variables that are specified in the ASSESS statement, as shown in Output 95.1.5.
Output 95.1.5: Standardized Differences Plot

The "Standardized Variable Differences Plot" displays the standardized differences in the "Variable Differences" table in Output 95.1.4. All differences for the matched observations are within the recommended limits of –0.25 and 0.25, which are indicated by reference lines.
The PLOTS=BOXPLOT option requests a box plot for the logit of propensity score (LPS) and for each continuous variable specified in the ASSESS statement, as shown in Output 95.1.6, Output 95.1.7, and Output 95.1.8. The box plots show good variable balance for the weighted support region observations.
Output 95.1.6: LPS Box Plot

Output 95.1.7: Age Box Plot

Output 95.1.8: Bmi Box Plot

The PLOTS=BARCHART option displays a bar chart for each classification variable that is specified in the ASSESS statement, as shown in Output 95.1.9. The bar chart displays similar distributions of Gender between males and females for the weighted support region observations.
Output 95.1.9: Gender Bar Chart

Because there is good balance in the weighted distributions of the variables Gender, Age, and Bmi, you can output all observations (including added observation weights) so that they can be used for subsequent weighted outcome analysis.
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 by using nonlinear terms for the continuous variables or by adding interactions (Rosenbaum and Rubin 1984), or you can choose another propensity score method (such as matching).
The OUT(OBS=ALL)=OutEx1 option in the OUTPUT statement creates an output data set, OutEx1, that contains all available observations. The following statements list the first 10 observations in OutEx1, as shown in Output 95.1.10.
proc print data=OutEx1(obs=10); var PatientID Drug Gender Age Bmi _ps_ _AttWgt_; run;
Output 95.1.10: Output Data Set with PS Weights
| Obs | PatientID | Drug | Gender | Age | Bmi | _PS_ | _ATTWGT_ |
|---|---|---|---|---|---|---|---|
| 1 | 284 | Drug_X | Male | 29 | 22.02 | 0.36444 | 1.00000 |
| 2 | 201 | Drug_A | Male | 45 | 26.68 | 0.22296 | 0.28694 |
| 3 | 147 | Drug_A | Male | 42 | 21.84 | 0.11323 | 0.12768 |
| 4 | 307 | Drug_X | Male | 38 | 22.71 | 0.19733 | 1.00000 |
| 5 | 433 | Drug_A | Male | 31 | 22.76 | 0.35311 | 0.54586 |
| 6 | 435 | Drug_A | Male | 43 | 26.86 | 0.27263 | 0.37482 |
| 7 | 159 | Drug_A | Female | 45 | 25.47 | 0.14911 | 0.17523 |
| 8 | 368 | Drug_A | Female | 49 | 24.28 | 0.07780 | 0.08437 |
| 9 | 286 | Drug_A | Male | 31 | 23.31 | 0.38341 | 0.62182 |
| 10 | 163 | Drug_X | Female | 39 | 25.34 | 0.24995 | 1.00000 |
By default, the output data set includes the variable _PS_ (which provides the propensity score) and the variable _ATTWGT_ (which provides matched observation weights). The weight for each treated unit is 1, and the weight for each control unit is computed as p / (1 – p), where p is the propensity score.
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 OutEx1, you can use the same outcome analysis with weights on this output data set as you would have used on the original data set Drugs (augmented with responses) to estimate the treatment effect.
Copyright © SAS Institute Inc. All rights reserved.