The PSMATCH Procedure
Example 95.7 Matching with Existing Propensity Scores in the Input Data Set
(View the complete code for this example.)
This example performs optimal matching with propensity scores already available in the input data set. The Drugs data set contains the patient information and is described in the section Getting Started: PSMATCH Procedure.
The following statements use the LOGISTIC procedure to fit a binary complementary log-log model and to derive propensity scores:
ods select none; proc logistic data=drugs; class Drug Gender; model Drug(Event='Drug_X')= Gender Age Bmi / link=cloglog; output out=drug1 p=pscore; run; ods select all;
The output data set Drug1 is constructed from the data set Drugs and contains the PScore variable for propensity scores.
Output 95.7.1 lists the first 10 observations.
Output 95.7.1: Output Drug Data Set with Propensity Scores
| First 10 Observations of the Input Drug Data Set |
| Obs | PatientID | Drug | Gender | Age | Bmi | pscore |
|---|---|---|---|---|---|---|
| 1 | 284 | Drug_X | Male | 29 | 22.02 | 0.35498 |
| 2 | 201 | Drug_A | Male | 45 | 26.68 | 0.21794 |
| 3 | 147 | Drug_A | Male | 42 | 21.84 | 0.12261 |
| 4 | 307 | Drug_X | Male | 38 | 22.71 | 0.19821 |
| 5 | 433 | Drug_A | Male | 31 | 22.76 | 0.34298 |
| 6 | 435 | Drug_A | Male | 43 | 26.86 | 0.26261 |
| 7 | 159 | Drug_A | Female | 45 | 25.47 | 0.15077 |
| 8 | 368 | Drug_A | Female | 49 | 24.28 | 0.08713 |
| 9 | 286 | Drug_A | Male | 31 | 23.31 | 0.37211 |
| 10 | 163 | Drug_X | Female | 39 | 25.34 | 0.24005 |
The following statements invoke the PSMATCH procedure and request an optimal matching to match patients in the treatment group to patients in the control group:
ods graphics on; proc psmatch data=Drug1 region=cs; class Drug Gender; psdata treatvar=Drug(Treated='Drug_X') ps=pscore; match method=optimal(k=1) exact=Gender stat=lps caliper=0.5; assess lps var=(Gender Age Bmi) / weight=none; output out(obs=match)=OutEx7 lps=_Lps matchid=_MatchID; run;
The CLASS statement specifies the classification variables. The PSDATA statement specifies the binary treatment variable and the variable for propensity score information in the input DATA= data set. The TREATVAR=DRUG option specifies DRUG as the binary treatment indicator variable, and TREATED='Drug_X' identifies Drug_X as the treated group
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 the pooled estimate of the common standard deviation of the logit of the propensity score, where this estimate is the square root of the average of the variances in the treated and control groups.
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.5 option specifies the caliper requirement for matching: for a match to be made, the difference in the logits of the propensity score for pairs of individuals from the two groups must be less than or equal to 0.5 times the pooled estimate of the common standard deviation of the logits of propensity scores.
The "Data Information" table in Output 95.7.2 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, 352 fall within the support region.
Output 95.7.2: Data Information
| Data Information | |
|---|---|
| Data Set | WORK.DRUG1 |
| Output Data Set | WORK.OUTEX7 |
| Treatment Variable | Drug |
| Treatment Group | Drug_X |
| All Obs (Treatment) | 113 |
| All Obs (Control) | 373 |
| Support Region | Extended Common Support |
| Lower PS Support | 0.060563 |
| Upper PS Support | 0.698199 |
| Support Region Obs (Treatment) | 113 |
| Support Region Obs (Control) | 352 |
The "Propensity Score Information" table in Output 95.7.3 displays summary statistics by treatment group for all observations, for the support region observations, and for the matched observations.
Output 95.7.3: 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.304022 | 0.128669 | 0.071521 | 0.659420 | 373 | 0.208864 | 0.125520 | 0.029452 | 0.713529 |
| Region | 113 | 0.304022 | 0.128669 | 0.071521 | 0.659420 | 352 | 0.214597 | 0.117684 | 0.060627 | 0.651891 |
| Matched | 113 | 0.304022 | 0.128669 | 0.071521 | 0.659420 | 113 | 0.298444 | 0.121541 | 0.072344 | 0.651891 |
The "Matching Information" table in Output 95.7.4 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.
Output 95.7.4: Matching 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 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 displays standardized differences between the treated and control groups for all observations, for the support region observations, and for the matched observations, as shown in Output 95.7.5. For a binary classification variable (Gender), the difference is in the proportion of the first ordered level (Female).
Output 95.7.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 | Matched Obs | All Obs | Region Obs | Matched Obs | Region Obs | Matched Obs | All Obs | Region Obs | Matched Obs | ||
| LPS | 0.582391 | 0.516130 | 0.022677 | 0.712102 | 0.817848 | 0.724797 | 0.031845 | 11.38 | 96.11 | 0.7177 | 0.9052 | 1.0929 |
| Age | -4.095091 | -3.585152 | 0.115044 | 6.079104 | -0.673634 | -0.589750 | 0.018925 | 12.45 | 97.19 | 0.7076 | 0.7928 | 1.0143 |
| Bmi | 0.739296 | 0.650890 | 0.146195 | 1.923178 | 0.384414 | 0.338445 | 0.076017 | 11.96 | 80.23 | 0.8854 | 0.9394 | 1.3509 |
| Gender | -0.024817 | -0.018076 | 0 | 0.496925 | -0.049941 | -0.036376 | 0 | 27.16 | 100.00 | 0.9892 | 0.9916 | 1.0000 |
The standardized mean differences are significantly reduced in the matched observations, and the largest of these differences is 0.076 in absolute value, which is less than the recommended upper limit of 0.25. 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 Output 95.7.6.
Output 95.7.6: Standardized Differences Plot

The "Standardized Variable Differences Plot" displays the standardized differences in the "Standardized Variable Differences" table in Output 95.7.5. All differences for the matched observations are within the recommended limits of –0.25 and 0.25, which are indicated by reference lines.
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 matching criteria, or you can choose another matching method.
The OUT(OBS=MATCH)=OutEx7 option in the OUTPUT statement creates an output data set, OutEx7, that contains the matched observations. The following statements list the 10 observations OutEx7 that have lowest propensity scores, as shown in Output 95.7.7:
proc sort data=OutEx7 out=OutEx7a; by pscore; run; proc print data=OutEx7a(obs=10); var PatientID Drug Gender Age Bmi pscore _LPS _MatchWgt_ _MatchID; run;
Output 95.7.7: Output Data Set With Optimal Matches
| Obs | PatientID | Drug | Gender | Age | Bmi | pscore | _Lps | _MATCHWGT_ | _MatchID |
|---|---|---|---|---|---|---|---|---|---|
| 1 | 89 | Drug_X | Female | 44 | 20.75 | 0.07152 | -2.56356 | 1 | 1 |
| 2 | 213 | Drug_A | Female | 49 | 23.24 | 0.07234 | -2.55123 | 1 | 1 |
| 3 | 323 | Drug_X | Female | 46 | 22.22 | 0.07822 | -2.46677 | 1 | 2 |
| 4 | 245 | Drug_A | Female | 52 | 25.32 | 0.08090 | -2.43015 | 1 | 2 |
| 5 | 217 | Drug_X | Male | 49 | 23.96 | 0.09796 | -2.22013 | 1 | 3 |
| 6 | 429 | Drug_A | Male | 49 | 24.00 | 0.09865 | -2.21228 | 1 | 3 |
| 7 | 234 | Drug_X | Female | 41 | 21.11 | 0.09887 | -2.20987 | 1 | 4 |
| 8 | 66 | Drug_A | Female | 48 | 24.53 | 0.09927 | -2.20531 | 1 | 4 |
| 9 | 183 | Drug_A | Female | 45 | 23.62 | 0.10931 | -2.09786 | 1 | 5 |
| 10 | 320 | Drug_X | Female | 46 | 24.17 | 0.11056 | -2.08507 | 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= 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, which 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 data set OutEx7, you can use the same outcome analysis on this output data set as you would have used on the original data set Drugs (with added responses) to estimate the treatment effect.
Copyright © SAS Institute Inc. All rights reserved.