PROC ASSIGN for global optimal matching with replacement? (propensity score

Reply
N/A
Posts: 1

PROC ASSIGN for global optimal matching with replacement? (propensity score

Hi All,

So happy to find this forum! This is my first post here. I've been using PROC ASSIGN to do global optimal propensity score matching without replacement. I've recently read a few papers that strongly recommended matching with replacement. Makes complete sense to me---just have absolutely no idea how to implement this in my SAS code. I'm more of a happy SAS user than a gifted SAS programmer. Sigh... Do any of you by any chance know how to do this with replacement with PROC ASSIGN or have any idea of who I might ask about this? I'll be tremendously appreciative of any tips or leads you may have.

Best,

Sharon


Here's my code for global optimal matching (adapted from SAS white paper 185-2007 by Marcelo Coca-Perraillon).

1. First inputting the data for propensity scores for cases and controls...just including this step so you can follow this.

data Treatment1;
input idT pscoreT; /* Putting in an id and estimated propensity score for Treated */
datalines;

15 -2.78054
17 -1.69799
24 -0.63667
26 -2.44037
.
.
.

861 -3.43338
875 -0.96757
;

data Control1; /* IDs and propensity scores for controls */
input idC pscoreC;
datalines;
21 0.1636
27 -0.05265
31 1.17403
.
.
.
877 -0.12449
888 0.58;


proc sort data=Control1 out=_Control0;
by idC;
run;

data _Control1;
set _Control0;
DistCol= compress('d' || _N_);
run;

data DistMatrix1 (keep= idT d1-d106);
length pscoreC 8;
length idC 8;
if _N_=1 then do;
declare hash h(dataset: "_Control1", ordered: 'ascending');
declare hiter iter('h');
h.defineKey('idC');
h.defineData('pscoreC', 'idC');
h.defineDone();
call missing(idC, pscoreC);
end;

set Treatment1;
array dis(*) d1-d106;
rc=iter.first();
if (rc=0) then i=1;
do while (rc = 0);
dis(i)= abs(pscoreT - pscoreC);
i+1;
rc=iter.next();
if (rc~=0) then output;
end;
run;

proc assign data=DistMatrix1 out=Result1;
cost d1-d106;
id idT;
run;


proc sql;
create table MatchedOpt1 as
select b.idc as IDSelectControl1, a.idT as IDTreatment1
from result1 a left join _Control1 b
on a._Assign_ = b.DistCol;
quit;
Ask a Question
Discussion stats
  • 0 replies
  • 267 views
  • 0 likes
  • 1 in conversation