### About this blog

Rick Wicklin, PhD, is a distinguished researcher in computational statistics at SAS and is a principal developer of PROC IML and SAS/IML Studio. This blog focuses on statistical programming. It discusses statistical and computational algorithms, statistical graphics, simulation, efficiency, and data analysis. Rick is author of the books

*Statistical Programming with SAS/IML Software*and*Simulating Data with SAS*.

Follow @RickWicklin on Twitter.

**Do you have a SAS programming question?**Assistance is available! Ask SAS/IML questions at the SAS/IML Support Community. For other SAS issues, visit the SAS Support Communities.### Tags

9.3 9.4 9.22 12.1 12.3 13.1 13.2 14.1 Bootstrap and Resampling Ciphers Conferences Data Analysis Efficiency File Exchange Getting Started GTL Heat maps History IMLPlus Just for Fun Math Matrix Computations Numerical Analysis Optimization R Reading and Writing Data SAS/IML Studio SAS Global Forum SAS Programming Simulation Statistical Graphics Statistical Programming Statistical Thinking Strings Tips and Techniques vectorization Video### Archives

### Subscribe to this blog

## Create and use a permutation matrix in SAS

Suppose that you compute the correlation matrix (call it R1) for a set of variables x1, x2, ..., x8. For some reason, you later want to compute the correlation matrix for the variables in a different order, maybe x2, x1, x7,..., x6. Do you need to go back to the [...]

Post a Comment ## Matrix multiplication with missing values in SAS

Sometimes I get contacted by SAS/IML programmers who discover that the SAS/IML language does not provide built-in support for multiplication of matrices that have missing values. (SAS/IML does support elementwise operations with missing values.) I usually respond by asking what they are trying to accomplish, because mathematically matrix multiplication with [...]

Post a Comment ## Twelve posts from 2014 that deserve a second look

I began 2015 by compiling a list of popular articles from my blog in 2014. Although this "People's Choice" list contains many interesting articles, some of my favorites did not make the list. Today I present the "Editor's Choice" list of articles that deserve a second look. I've highlighted one [...]

Post a Comment ## Self-similar structures from Kronecker products

I recently posted an article about self-similar structures that arise in Pascal's triangle. Did you know that the Kronecker product (or direct product) can be used to create matrices that have self-similar structure? The basic idea is to start with a 0/1 matrix and compute a sequence of direct products [...]

Post a Comment ## The direct product (Kronecker product) in SAS

There are many ways to multiply scalars, vectors, and matrices, but the Kronecker product (also called the direct product) is multiplication on steroids. The Kronecker product looks scary, but it is actually simple. The Kronecker product is merely a way to pack multiples of a matrix B into a block [...]

Post a Comment ## A matrix computation on Pascal's triangle

A colleague asked me a question regarding my recent post about the Pascal triangle matrix. While responding to his question, I discovered a program that I had written in 1999 that computed with a Pascal triangle matrix. Wow, I've been computing with Pascal's triangle for 15 years! I don't know [...]

Post a Comment ## An efficient way to increment a matrix diagonal

I was recently asked about how to use the SAS/IML language to efficiently add a constant to every element of a matrix diagonal. Mathematically, the task is to form the matrix sum A + kI, where A is an n x n matrix, k is a scalar value, and I is the [...]

Post a Comment ## Compute the log-determinant of an arbitrary matrix

A few years ago I wrote an article that shows how to compute the log-determinant of a covariance matrix in SAS. This computation is often required to evaluate a log-likelihood function. My algorithm used the ROOT function in SAS/IML to compute a Cholesky decomposition of the covariance matrix. The Cholesky [...]

Post a Comment ## Using associativity can lead to big performance improvements in matrix multiplication

In a previous post, I stated that you should avoid matrix multiplication that involves a huge diagonal matrix because that operation can be carried out more efficiently. Here's another tip that sometimes improves the efficiency of matrix multiplication: use parentheses to prevent the creation of large matrices. Matrix multiplication is [...]

Post a Comment ## Never multiply with a large diagonal matrix

I love working with SAS Technical Support because I get to see real problems that SAS customers face as they use SAS/IML software. The other day I advised a customer how to improve the efficiency of a computation that involved multiplying large matrices. In this article I describe an important [...]

Post a Comment