Example using a R default data matcars.

library(MatchIt)

m.out0<-matchit(data=mtcars,am~hp+drat,exact=c("vs"),method="nearest", ratio=1, m.order="random", caliper=0.25)

m.out0

Skip to content
# Category: PSM (Propensity Score Matching)

## R package matchit

## SAS PSMATCH

## Propensity score matching

## SAS propensity score matching procedure

Example using a R default data matcars.

library(MatchIt)

m.out0<-matchit(data=mtcars,am~hp+drat,exact=c("vs"),method="nearest", ratio=1, m.order="random", caliper=0.25)

m.out0

https://support.sas.com/documentation/onlinedoc/stat/142/psmatch.pdf

p. 7679 about three options.

The PSMATCH procedure optionally matches observations in the treated and control groups. The procedure

provides three strategies for propensity score matching.

Greedy nearest neighbor matching selects the control unit nearest to each treated unit. Greedy nearest

neighbor matching is done sequentially for treated units and without replacement.

Optimal matching selects all control units that match each treated unit by minimizing the total absolute

difference in propensity score across all matches. Optimal matching selects all matches simultaneously

and without replacement. Three methods for optimal matching are available: fixed ratio matching,

variable ratio matching, and full matching.

Matching with replacement selects the control unit that best matches each treated unit. Each control

unit can be matched to more than one treated unit, but it can only be matched to the same treated unit

once.

Typing up an observation:

I had one old data and I updated two categorical variables (black and asian variables) in the new data. The change was only in one group in the data (there were 10 groups all together). Theoretically I would expect the matching results (in terms of means of the two variables) to change only in that group. The changes also happened in two other groups.

proc psmatch data=psm region=cs;

where &outcome ne .;

class CP_FLAG districtname SCHOOLNAME ;

psmodel CP_FLAG(Treated="Y")= &exactvar &predictors;

match method=greedy(k=1)/*(order=random)*/ exact=districtname stat=lps caliper=&caliper;

output out(obs=match)=outgs lps=_Lps matchid=_matchID;

run;

proc sort data=outgs;by _matchID;run;

proc psmatch data=psm region=cs;

where &outcome ne .;

class FLAG districtname SCHOOLNAME ;

psmodel FLAG(Treated="Y")= &exactvar &predictors;

match method=greedy(k=1)/*(order=random)*/ exact=districtname stat=lps caliper=&caliper;

output out(obs=match)=outgs lps=_Lps matchid=_matchID;

run;

proc sort data=outgs;by _matchID;run;