BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Is there any way to do in IML the optimal matching (like in PROC ASSIGN) ?
7 REPLIES 7
Rick_SAS
SAS Super FREQ
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
deleted_user
Not applicable
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.
Rick_SAS
SAS Super FREQ
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.
deleted_user
Not applicable
The code gets truncated here, how can I send it to you ? Message was edited by: Zbig
deleted_user
Not applicable
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.
Hutch_sas
SAS Employee
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.
deleted_user
Not applicable
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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

From The DO Loop
Want more? Visit our blog for more articles like these.
Discussion stats
  • 7 replies
  • 1488 views
  • 0 likes
  • 3 in conversation