Hi all, I am using hash iteration in below code for matching the observations of two groups, how can I iterate the hash for N times? (the below code matches one control to one treated group, how can i get 5 controls for each treated? ( This is a without replacemnet matching methd) data want; length psC 8; length idC 8; if _N_= 1 then do; declare hash h(dataset: "C", ordered: 'no'); declare hiter iter('h'); h.defineKey('idC'); h.defineData('psC', 'idC'); h.defineDone(); call missing(idC, pscoreC); end; set T; retain BestDistance 99; rc= iter.first(); if (rc=0) then BestDistance= 99; do while (rc= 0); ScoreDistance= abs(pscoreT - pscoreC); if ScoreDistance < BestDistance then do; BestDistance= ScoreDistance; IdSelectedControl= idC; MatchedToTreatID= idT; end; rc= iter.next(); if (rc~= 0) then do; output; rc1= h.remove(key: IdSelectedControl); end; end; run; your help will be appreciated Rama
... View more