I cannot use the vmatch provided by you because it has the proc optnet and I'm still on 9.3 M1. I've used the proc optmodel but it runs out of memory: proc optmodel; /* define sets for cases and controls */ set <str> CASES; set <str> CONTROLS init (union{i in 1..12574} {"control"||i}); /* define cost parameter */ num cost{CASES, CONTROLS}; /* read in data including missing values */ read data tr into CASES = [key] {j in CONTROLS} < cost[key, j] = col(j) >; /* create a set of pairs which are possible, i.e. cost is not missing */ set <string, string> POSSIBLE = {i in CASES, j in CONTROLS: cost[i,j] >= 0}; /* we only need variables for possible pairs */ var Assign{CASES,CONTROLS} >= 0; num maxCost = max{<i,j> in POSSIBLE} cost[i,j]; min z = sum {<i,j> in POSSIBLE} cost[i,j]*Assign[i,j] /*- sum {<i,j> in POSSIBLE} (maxCost+1)*Assign[i,j]*/; *** Constraint that each case has to be assigned to one control ***; con case_assign{i in CASES}: sum{<(i),j> in POSSIBLE}Assign[i,j] <= 4; *** Constraint that each control can be used only once ***; con control_assign{j in CONTROLS}: sum{<i,(j)> in POSSIBLE} Assign[i,j] <= 1; /* solve the model */ solve with lp; /* print the result */ *print Assign; create data assign from [i j] = {i in CASES, j in CONTROLS: Assign[i,j] >= 0.5} cost; quit; I've tried the vmatch downloaded from Mayo but it runs 24 hours and I stopped: %vmatch(dist = tr, idca = key, a = 1, b = 4, lilm = 12574, n = 3069, firstco = control3453, lastco = control1999 ,print = n, out = result); Finally I'm trying a simple proc assign, that with some modifications (deleting the controls picked,...) I'll repeat 4 times in order to get 4 controls but I got the error posted above: proc assign data = tr out = result_1; cost &start -- &end; id key; run;
... View more