About this blog
Rick Wicklin, PhD, is a senior researcher in computational statistics at SAS and is a principal developer of PROC IML and SAS/IML Studio. His areas of expertise include computational statistics, statistical graphics, and modern methods in statistical data analysis. Rick is author of the book Statistical Programming with SAS/IML Software.

Follow @RickWicklin on Twitter.
Subscribe to this blog
Tags
Archives
How to read data set variables into SAS/IML vectors
One of the first skills that a beginning SAS/IML programmer learns is how to read data from a SAS data set into SAS/IML vectors. (Alternatively, you can read data into a matrix). The beginner is sometimes confused about the syntax of the READ statement: do you specify the names of [...]
Post a Comment Creating symmetric matrices: Two useful functions with strange names
Covariance, correlation, and distance matrices are a few examples of symmetric matrices that are frequently encountered in statistics. When you create a symmetric matrix, you only need to specify the lower triangular portion of the matrix. The VECH and SQRVECH functions, which were introduced in SAS/IML 9.3, are two functions [...]
Post a Comment Reading ALL variables INTO a matrix
The SAS/IML READ statement has a few convenient features for reading data from SAS data sets. One is that you can read all variables into vectors of the same names by using the _ALL_ keyword. The following DATA steps create a data set called Mixed that contains three numeric and [...]
Post a Comment Reading variables with a common prefix
I got an email asking the following question: In the following program, I don’t know how many variables are in the data set A. However, I do know that the variable names are X1–Xk for some value of k. How can I read them all into a SAS/IML matrix when [...]
Post a Comment Reshape data so that each category becomes a new variable
Being able to reshape data is a useful skill in data analysis. Most of the time you can use the TRANSPOSE procedure or the SAS DATA step to reshape your data. But the SAS/IML language can be handy, too. I only use PROC TRANSPOSE a few times per year, so [...]
Post a Comment Random access: How to read specific observation in SAS/IML software
This article shows how to randomly access data in a SAS data set by using the READ POINT statement in SAS/IML software. I have previously discussed how to use the READ NEXT and READ CURRENT statements to sequentially access each observation in a SAS data set from PROC IML. Reading [...]
Post a Comment Sequential access: Reading one observation at a time in SAS/IML software
The most common way to read observations from a SAS data set into SAS/IML matrices is to read all of the data at once by using the ALL clause in the READ statement. However, the READ statement also has options that do not require holding all of the observations in [...]
Post a Comment Writing data from a matrix to a SAS data set
In a previous post, I showed how to read data from a SAS data set into SAS/IML matrices or vectors. This article shows the converse: how to use the CREATE, APPEND, and CLOSE statements to create a SAS data set from data stored in a matrix or in vectors. Creating [...]
Post a Comment How to create column names for matrices
Statistical programmers can be creative and innovative. But when it comes to choosing names of variables, often x1, x2, x3,… works as well as any other choice. In this blog post, I have two tips that are related to constructing variable names of the form x1, x2,…, xn. Both tips [...]
Post a Comment Reshaping data from wide to long format
As Cat Truxillo points out in her recent blog post, some SAS procedures require data to be in a “long” (as opposed to “wide”) format. Cat uses a DATA step to convert the data from wide to long format. Although there is nothing wrong with this approach, I prefer to [...]
Post a Comment 