The PSMATCH Procedure
Getting Started: PSMATCH Procedure
(View the complete code for this example.)
This example illustrates the use of the PSMATCH procedure to match observations for individuals in a treatment group with observations for individuals in a control group that have similar propensity scores. The matched observations are saved in an output data set which, with the addition of the outcome variable, can be used to provide an unbiased estimate of the treatment effect.
A pharmaceutical company is conducting a nonrandomized clinical trial to demonstrate the efficacy of a new treatment (Drug_X) by comparing it to an existing treatment (Drug_A). Patients in the trial can choose the treatment that they prefer; otherwise, physicians assign each patient to a treatment. The possibility of treatment selection bias is a concern because it can lead to systematic differences in the distributions of the baseline variables in the two groups, resulting in a biased estimate of treatment effect.
The data set Drugs contains baseline variable measurements for individuals from both treated and control groups. PatientID is the patient identification number, Drug is the treatment group indicator, Gender provides the gender, Age provides the age, and Bmi provides the body mass index (a measure of body fat based on height and weight). Typically, more variables are used in a propensity score analysis. In this example, only a few variables are used for a simple illustration of the use of the PSMATCH procedure.
Figure 95.2 lists the first 10 observations.
Figure 95.2: Input Drug Data Set
Note that the Drugs data set does not contain a response variable, because the response variable is not used in propensity score method. Instead, the response variable is added to the output data set of matched observations after matching for the outcome analysis.
The following statements invoke the PSMATCH procedure and request optimal matching to match observations for patients in the treatment group with observations for patients in the control group:
ods graphics on; proc psmatch data=drugs region=cs; class Drug Gender; psmodel Drug(Treated='Drug_X')= Gender Age Bmi; match method=optimal(k=1) exact=Gender stat=lps caliper=0.25; assess lps var=(Gender Age Bmi) / weight=none plots=(boxplot barchart); output out(obs=match)=Outgs lps=_Lps matchid=_MatchID; 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. Because the MATCH statement is also specified, the REGION=CS option requests that only observations that have propensity scores in the common support region be used for matching. By default, the region is extended by 0.25 times a pooled estimate of the common standard deviation of the logit of the propensity score. For details, see the description of the EXTEND= option.
The MATCH statement specifies the criteria for matching. The STAT=LPS option (which is the default) requests that the logit of the propensity score be used in computing differences between pairs of observations. The METHOD=OPTIMAL(K=1) option (which is the default) requests optimal matching of one control unit to each unit in the treated group in order to minimize the total within-pair difference, The EXACT=GENDER option forces the treated unit and its matched control unit to have the same value of the Gender variable.
The CALIPER=0.25 option specifies the caliper requirement for matching. This means that for a match to be made, the difference in the logits of the propensity scores for pairs of individuals from the two groups must be less than or equal to 0.25 times the pooled estimate of the common standard deviation of the logits of the propensity scores.
The "Data Information" table in Figure 95.3 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. Of the 373 observations in the control group, only 351 fall within the support region.
Figure 95.3: Data Information
| Data Information | |
|---|---|
| Data Set | WORK.DRUGS |
| Output Data Set | WORK.OUTGS |
| Treatment Variable | Drug |
| Treatment Group | Drug_X |
| All Obs (Treatment) | 113 |
| All Obs (Control) | 373 |
| Support Region | Extended Common Support |
| Lower PS Support | 0.050244 |
| Upper PS Support | 0.683999 |
| Support Region Obs (Treatment) | 113 |
| Support Region Obs (Control) | 351 |
The "Propensity Score Information" table in Figure 95.4 displays summary statistics by treatment group for all observations, for support region observations, and for matched observations.
Figure 95.4: Propensity Score Information
| Propensity Score Information | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Observations | Treated (Drug = Drug_X) | Control (Drug = Drug_A) | ||||||||
| N | Mean | Std Dev | Minimum | Maximum | N | Mean | Std Dev | Minimum | Maximum | |
| 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 | 351 | 0.217557 | 0.126747 | 0.050951 | 0.682374 |
| Matched | 113 | 0.310773 | 0.132467 | 0.060231 | 0.641148 | 113 | 0.308246 | 0.130999 | 0.061866 | 0.682374 |
The "Matching Information" table in Figure 95.5 displays the matching criteria, the number of matched sets, the numbers of matched observations in the treated and control groups, and the total absolute difference in the logit of the propensity score for all matches.
Figure 95.5: Matching Information
The ASSESS statement produces the tables and plots which 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 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=NONE option suppresses display of differences for the weighted matched observations. Note that for a matching of one control unit to each treated unit, the weights are all 1 for matched treated and control units, and the results are identical for the weighted matched observations and the matched observations.
The "Standardized Variable Differences" table, as shown in Figure 95.6. displays standardized differences between the treated and control groups for all observations, the support region observations, and the matched observations. For a binary classification variable (Gender), the difference is in the proportion of the first ordered level (Female).
Figure 95.6: Standardized Differences
| Standardized Variable Differences (Treated - Control) | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Variable | Standardized Mean Difference | |||||||||||
| Mean Difference | Divisor | Mean Difference | Percent Reduction | Variance Ratio | ||||||||
| All Obs | Region Obs | Matched Obs | All Obs | Region Obs | Matched Obs | Region Obs | Matched Obs | All Obs | Region Obs | Matched Obs | ||
| LPS | 0.639971 | 0.545459 | 0.010556 | 0.767448 | 0.833894 | 0.710744 | 0.013755 | 14.77 | 98.35 | 0.6517 | 0.8314 | 1.0155 |
| Age | -4.095091 | -3.493684 | 0.168142 | 6.079104 | -0.673634 | -0.574704 | 0.027659 | 14.69 | 95.89 | 0.7076 | 0.8000 | 1.1262 |
| Bmi | 0.739296 | 0.632566 | 0.124248 | 1.923178 | 0.384414 | 0.328917 | 0.064605 | 14.44 | 83.19 | 0.8854 | 0.9288 | 1.1967 |
| Gender | -0.024817 | -0.016514 | 0 | 0.496925 | -0.049941 | -0.033233 | 0 | 33.46 | 100.00 | 0.9892 | 0.9922 | 1.0000 |
The divisor is computed from all observations, and it is used as the denominator to compute standardized differences for all observations, for support region observations, and for matched observations. The standardized mean differences are significantly reduced in the matched observations. The largest of these differences in absolute value is 0.0646, which is less than the upper limit of 0.25 recommended by Rubin (2001, p. 174) and Stuart (2010, p. 11). However, many authors use an upper limit of 0.10 (Normand et al. 2001; Mamdani et al. 2005; Austin 2009).
The variance ratios between the two groups are between 1 and 1.1967 for all variables in the matched observations, which is within the recommended range of 0.5 to 2. Because both EXACT=GENDER and METHOD=OPTIMAL are specified in the MATCH statement, the standardized difference for Gender is 0 in the matched 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 Figure 95.7.
Figure 95.7: Standardized Differences Plot

The "Standardized Variable Differences Plot" displays the standardized differences in the "Variable Differences" table in Figure 95.6. All differences for the matched observations are within the recommended limits of –0.25 and 0.25, which are indicated by reference lines. Again, note that many authors use limits of –0.10 and 0.10. (Normand et al. 2001; Mamdani et al. 2005; Austin 2009).
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 Figure 95.8, Figure 95.9, and Figure 95.10. The box plots show good variable balance for the matched observations.
Figure 95.8: LPS Box Plot

Figure 95.9: Age Box Plot

Figure 95.10: 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 Figure 95.11. The bar chart displays identical distribution for matched observations for Gender because EXACT=GENDER is specified.
Figure 95.11: Gender Bar Chart

Because there is good balance in the distributions of the logit propensity score and the variables Gender, Age, and Bmi, you can output the matched observations for subsequent 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 (for instance, by using nonlinear terms for the continuous variables or by adding interactions), you can modify the matching criteria, or you can choose another matching method.
The OUT(OBS=MATCH)=Outgs option in the OUTPUT statement creates an output data set Outgs that contains the matched observations. The following statements list the 10 observations in Outgs that have lowest propensity scores, as shown in Figure 95.12.
proc sort data=outgs out=outgs1; by _ps_; run; proc print data=outgs1(obs=10); var PatientID Drug Gender Age Bmi _PS_ _LPS _MatchWgt_ _MatchID; run;
Figure 95.12: Output Data Set with Matching Numbers
| Obs | PatientID | Drug | Gender | Age | Bmi | _PS_ | _Lps | _MATCHWGT_ | _MatchID |
|---|---|---|---|---|---|---|---|---|---|
| 1 | 89 | Drug_X | Female | 44 | 20.75 | 0.06023 | -2.74744 | 1 | 1 |
| 2 | 213 | Drug_A | Female | 49 | 23.24 | 0.06187 | -2.71892 | 1 | 1 |
| 3 | 141 | Drug_A | Female | 43 | 20.55 | 0.06401 | -2.68256 | 1 | 2 |
| 4 | 323 | Drug_X | Female | 46 | 22.22 | 0.06763 | -2.62375 | 1 | 2 |
| 5 | 217 | Drug_X | Male | 49 | 23.96 | 0.08772 | -2.34184 | 1 | 3 |
| 6 | 290 | Drug_A | Female | 40 | 20.57 | 0.08778 | -2.34104 | 1 | 4 |
| 7 | 420 | Drug_A | Male | 45 | 22.08 | 0.08801 | -2.33813 | 1 | 3 |
| 8 | 234 | Drug_X | Female | 41 | 21.11 | 0.08904 | -2.32538 | 1 | 4 |
| 9 | 320 | Drug_X | Female | 46 | 24.17 | 0.10323 | -2.16183 | 1 | 5 |
| 10 | 473 | Drug_A | Female | 45 | 23.76 | 0.10464 | -2.14669 | 1 | 5 |
By default, the output data set includes the variable _PS_ (which provides the propensity score) and the variable _MATCHWGT_ (which provides matched observation weights). The weight for each treated unit is 1. Because K=1 is specified in the METHOD=OPTIMAL option in the MATCH statement, one control unit is matched to each treated unit; so the weight for each matched control unit is also 1. The LPS=_LPS option creates a variable named _LPS which provides the logit of propensity score, and the MATCHID=_MatchID option creates a variable named _MatchID that identifies the matched sets of observations.
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 matched data set Outgs, you can use the same outcome analysis on this matched data set as you would have used on the original data set Drugs (augmented with responses) to estimate the treatment effect (Ho et al. 2007, p. 233).
Copyright © SAS Institute Inc. All rights reserved.