I'm trying to pull the lower half of a matrix in proc iml. It seems like the VECH function would work perfectly, but I'm running SAS 9.2 and VECH appears to be limited to 9.3. Any suggestions for alternatives? It's all inside a loop and the matrix size changes (with each loop), but these are fairly large matrices (e.g., 3000 X 3000). Thanks!
This can be recreated using a short function module, but it is complicated slightly by the fact that the LOC function operates in row major order while the VECH function operates in column major order, and so the need to transpose the matrix. The code below should do the trick, but I have no idea how efficient or inefficient this might be with your large matrices.
Thanks for the info, I had read this article and come to the conclusion that VECH was something completely new, but it appears that SYMSQR does the same thing, only it reads the lower diagonal elements in row-major order, so the two do give different results. It would be nice if the 9.3 documentation for VECH could be changed to include a link to SYMSQR (and vice versa).
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.