Programming the statistical procedures from SAS

Propensity score matching

Regular Contributor
Posts: 173

Propensity score matching

Has anyone worked on Propensity score matching? ANy ideas how to go about it? I have never done that before. I use SAS.

Are there any macro programs available to do it?

Any help will be appreciated.


Super User
Super User
Posts: 7,255

Re: Propensity score matching

Posted in reply to Ashwini_uci

I have a simple one that I wrote a couple of years ago based on ideas in a paper by Craig Roberts and John R. Gerlach and the

PSMatching macro presented at SAS Global Forum 2007 by Marcelo Coca Perraillon.

It assumes that you have already calculated a single numeric score variable that will be used to match cases to controls.

Here is the program header that describes what it can do.

%macro psmatch


Propensity Score Matching - match treated cases to controls


(treated=       /* Input dataset of treated cases (REQ) */

,control=       /* Input dataset of controls (REQ) */

,out=           /* Output dataset of matched id numbers (DEF=MATCH) */

,method=        /* Matching method (NN RADIUS CALIPER) (DEF=NN) */

,caliper=       /* Pscore delta (used by CALIPER and RADIUS method)*/

,id=            /* Name of ID variable (DEF=ID) */

,pscore=        /* Name of Propensity Score variable (DEF=PSCORE) */

,nmatch=        /* Number of controls to match per subject (DEF=1) */

,replacement=   /* Select controls with replacement? (def=Y) */

,seed1=         /* Seed for randomizing treated case order */

,seed2=         /* Seed for randomizing control order */



Propensity Score Matching

Match treated cases to one or more controls. This does simple distance

based on absolute difference between the Propensity Score of the case

and the potential matched control. The propensity score variable must

already be in the input datasets. Three methods of selecting the matches

are available.


  NN      - Nearest neighbor. Find control with closest propensity score.

  CALIPER - Same as NN but only consider scores within +/- &CALIPER

  RADIUS  - Match ALL controls within +/- &CALIPER

Based on ideas in paper by Craig Roberts and John R. Gerlach and the

PSMatching macro presented at SAS Global Forum 2007 by Marcelo Coca



- TREATED and CONTROL input datasets use same variable names for ID

   and  propensity score variables.

- The propensity score variable must be numeric.

- The ID values must be unique keys for their datasets.

Calls to:


  Dataset with list of matched cases and controls. The output dataset

is not sorted. Unmatched treated cases are not included in the output.

  VAR      Description

  -------- -------------------------------------------------------

  IDT      Treated case ID

  IDC      Control case ID

  DISTANCE Distance between the propensity scores (absolute value)

Usage Notes:

- When using SAS Version 9.1 or higher will use a hash object.

- Creates work datasets _TREATED and _CONTROL.

- When NMATCH > 1 then also creates and deletes view _TREATV_.

- When METHOD=RADIUS replacement parameter does not apply. Controls

   are selected within a treated case without replacement but are

   available for matching to other treated cases (with replacement).

- Treated and Control datasets are randomly ordered so that when there

   are multiple controls of equal distance a random one will be




02AUG2009  abernt Creation


Posts: 25

Propensity score matching

Posted in reply to Ashwini_uci


If you are interested in the analysis of observational studies,

I reccommend the following book. I think the chapter 3 will help you especially.

Analysis of Observational Health Care Data Using SAS

Good luck.


Ask a Question
Discussion stats
  • 2 replies
  • 3 in conversation