Statistical programming, matrix languages, and more

Optimal matching

Reply
N/A
Posts: 0

Optimal matching

Is there any way to do in IML the optimal matching (like in PROC ASSIGN) ?
SAS Super FREQ
Posts: 3,234

Re: Optimal matching

Is there a way? Yes, but that doesn't mean it is the best or easiest way. If you previously used PROC ASSIGN (which is part of SAS/OR software), I suggest using PROC OPTMODEL, which provides a natural way to specify linear programming problems and is designed specifically for linear programming. For details and an example, see http://support.sas.com/kb/42/143.html
N/A
Posts: 0

Re: Optimal matching

Thanks for the reply. The distance I am using for matching is the generalized Mahalanobis distance GMD (with some weights, http://sekhon.berkeley.edu/papers/GenMatch.pdf), which is easy to calculate in IML. The loop is:
1. start with initial set of weights
2. create GMD matrix
3. do optimal match
4. check balance of covariates between matched cases and controls
5. if unbalanced then modify weights and goto 2.
I don't know how to do this matrix algebra in OPTMODEL.
SAS Super FREQ
Posts: 3,234

Re: Optimal matching

Sounds like an interesting problem. Could you post a simple example (4 or 5 observations) and the code you have so far, so we can better understand the problem? I've never used PROC ASSIGN so it would be helpful to see an example.
N/A
Posts: 0

Re: Optimal matching

The code gets truncated here, how can I send it to you ? Message was edited by: Zbig
N/A
Posts: 0

Re: Optimal matching

OK, I know now how to do this algebra in OPTMODEL (this is the multiplicative product of several matrices only, I can code it). But the IML gives me the Genetic Algorithm framework, which is not available in OPTMODEL.
SAS Employee
Posts: 94

Re: Optimal matching

What version of IML are you using? If you are using PROC IML, the latest version, 9.22, allows you to submit arbitrary SAS code from inside your IML program via a SUBMIT block. So, if you have this version of IML and you have SAS/OR, you should be able to use the fast and exact solvers in SAS/OR to solve the optimization problem exactly and quickly (provided you have a manageable problem size). If you have an earlier version of SAS/IML, if you can use IML Studio that also has a SUBMIT block for submitting SAS code. It is possible to apply genetic algorithms (GA) in PROC IML to try to solve the optimization problem, but the problem with GA in general is that you are not guaranteed convergence, and if you do get a solution you have no way to know if it is the true global optimum. Also for a problem of this type, the integer linear programming solvers available in SAS/OR will use a fraction of the time that a GA would use. So, do you have a version of IML with the SUBMIT block available? If so that would be far preferable to trying to use GA.
N/A
Posts: 0

Re: Optimal matching

I want to run GA and for each individual (which is a set of weights to be used to calculate generalized mahalanobis distances) I need to perform optimal matching. This is why it is important to do it within IML, as calling external procedure would take time.
I think I have managed to use IML's LP function to do the optimal match. Thanks. But apparently the IML's LP is much much slower than LP solver in OPTMODEL ...


Message was edited by: Zbig
Post a Question
Discussion Stats
  • 7 replies
  • 466 views
  • 0 likes
  • 3 in conversation