The PSMATCH Procedure

Example 95.6 Mahalanobis Distance Matching

(View the complete code for this example.)

This example performs Mahalanobis distance matching, where the distances between patients in the treatment group and patients in the control group are computed from a set of variables. The data set Drugs contains the patient information and is described in the section Getting Started: PSMATCH Procedure.

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, based on Mahalanobis distances:

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=mah(lps var=(Age Bmi)) caliper=.25;
   assess lps var=(Gender Age Bmi) / weight=none;
   output out(obs=match)=OutEx6 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 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=MAH(LPS VAR=(AGE Bmi)) option requests that the Mahalanobis distance, computed from the logit of propensity score and the Age and Bmi variables, 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: 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.25 times the pooled estimate of the common standard deviation of the logits of the propensity scores.

The "Data Information" table in Output 95.6.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. Of the 373 observations in the control group, 351 fall within the support region.

Output 95.6.1: Data Information

The PSMATCH Procedure

Data Information
Data SetWORK.DRUGS
Output Data SetWORK.OUTEX6
Treatment VariableDrug
Treatment GroupDrug_X
All Obs (Treatment)113
All Obs (Control)373
Support RegionExtended Common Support
Lower PS Support0.050244
Upper PS Support0.683999
Support Region Obs (Treatment)113
Support Region Obs (Control)351


The "Propensity Score Information" table in Output 95.6.2 displays summary statistics by treatment group for all observations, for support region observations, and for matched observations.

Output 95.6.2: Propensity Score Information

Propensity Score Information
ObservationsTreated (Drug = Drug_X)Control (Drug = Drug_A)
NMeanStd DevMinimumMaximumNMeanStd DevMinimumMaximum
All1130.3107730.1324670.0602310.6411483730.2088010.1319690.0201570.685757
Region1130.3107730.1324670.0602310.6411483510.2175570.1267470.0509510.682374
Matched1130.3107730.1324670.0602310.6411481130.3053090.1335600.0640100.682374


The "Matching Information" table in Output 95.6.3 displays the matching criteria, the number of matched sets, the numbers of matched observations in the treated and control groups, and the total Mahalanobis difference for all matches.

Output 95.6.3: Matching Information

Matching Information
Difference StatisticMahalanobis Distance
Mahalanobis CovarianceControl Group
MethodOptimal Fixed Ratio Matching
Control/Treated Ratio1
Caliper (Logit PS)0.191862
Matched Sets113
Matched Obs (Treated)113
Matched Obs (Control)113
Total Absolute Difference24.46784


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, as shown in Output 95.6.4. 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).

Output 95.6.4: Standardized Differences

The PSMATCH Procedure

Standardized Variable Differences (Treated - Control)
Variable Standardized Mean Difference 
Mean DifferenceDivisorMean DifferencePercent ReductionVariance Ratio
All ObsRegion ObsMatched ObsAll ObsRegion ObsMatched ObsRegion ObsMatched ObsAll ObsRegion ObsMatched Obs
LPS0.6399710.5454590.0263210.7674480.8338940.7107440.03429714.7795.890.65170.83140.9899
Age-4.095091-3.493684-0.1946906.079104-0.673634-0.574704-0.03202614.6995.250.70760.80001.0214
Bmi0.7392960.6325660.0188501.9231780.3844140.3289170.00980114.4497.450.88540.92881.0744
Gender-0.024817-0.01651400.496925-0.049941-0.033233033.46100.000.98920.99221.0000


The standardized mean differences are significantly reduced in the matched observations, and the largest of these differences is 0.0343 in absolute value, which is less than the recommended upper limit of 0.25. The variance ratios between the two groups are also in 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.6.5.

Output 95.6.5: Standardized Differences Plot

Standardized Differences Plot


The "Standardized Variable Differences Plot" displays the standardized differences in the "Variable Differences" table in Output 95.6.4. 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)=OutEx6 option in the OUTPUT statement creates an output data set, OutEx6, that contains the matched observations. The following statements list the 10 observations in OutEx6 that have lowest propensity scores, as shown in Output 95.6.6:

proc sort data=OutEx6 out=OutEx6a;
   by _ps_;
run;

proc print data=OutEx6a(obs=10);
    var PatientID Drug Gender Age Bmi _ps_ _MatchWgt_ _MatchID;
run;

Output 95.6.6: Output Data Set with Mahalanobis Distance Matches

ObsPatientIDDrugGenderAgeBmi_PS__MATCHWGT__MatchID
189Drug_XFemale4420.750.0602311
2141Drug_AFemale4320.550.0640111
3323Drug_XFemale4622.220.0676312
4137Drug_AFemale4522.040.0721512
5111Drug_AFemale4121.010.0871414
6217Drug_XMale4923.960.0877213
7429Drug_AMale4924.000.0884813
8234Drug_XFemale4121.110.0890414
9183Drug_AFemale4523.620.1015716
10189Drug_AFemale4624.100.1017115


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 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 data set OutEx6, you can use the same outcome analysis on this output data set as you would have used on the original data set Drugs (augmented with responses) to estimate the treatment effect.