In SAS/IML, the SHAPECOL function is used to generate vec(A). You can use the SHAPE function to generate vec(A`) directly, without using any transpose operators.
Explicitly forming a permutation matrix is usually inefficient because you are using an nxn matrix to represent a permutation on N elements. I avoid permutation matrices whenever possible and use the permutation as a subscript index to map a vector to a permutation of iteself. However, if you insists on it, you can generate a permutation matrix from a permutation vector by using the function in this blog post: Automating the Great Christmas Gift Exchange - The DO Loop
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.