The DO Loop
Statistical programming in SAS with an emphasis on SAS/IML programs![The module that vanished](https://blogs.sas.com/content/iml/files/2011/08/t_modvanish.png)
Recently, I needed to detect whether a matrix consists entirely of missing values. I wrote the following module: proc iml; /** Module to detect whether all elements of a matrix are missing values. Works for both numeric and character matrices. Version 1 (not optimal) **/ start isMissing(x); if type(x)='C' then
![How to find and fix programming errors](https://blogs.sas.com/content/iml/files/2011/08/imlpluserror.png)
NOTE: SAS stopped shipping the SAS/IML Studio interface in 2018. The references in this article to IMLPlus and SAS/IML Studio are no longer relevant. There are three kinds of programming errors: parse-time errors, run-time errors, and logical errors. It doesn't matter what language you are using (SAS/IML, MATLAB, R, C/C++,
![Converting between correlation and covariance matrices](https://blogs.sas.com/content/iml/files/2017/01/ProgrammingTips-2.png)
Both covariance matrices and correlation matrices are used frequently in multivariate statistics. You can easily compute covariance and correlation matrices from data by using SAS software. However, sometimes you are given a covariance matrix, but your numerical technique requires a correlation matrix. Other times you are given a correlation matrix,
![Computing covariance and correlation matrices Computing covariance and correlation matrices in SAS](https://blogs.sas.com/content/iml/files/2011/08/t_covcorr.png)
Sample covariance matrices and correlation matrices are used frequently in multivariate statistics. This post shows how to compute these matrices in SAS and use them in a SAS/IML program. There are two ways to compute these matrices: Compute the covariance and correlation with PROC CORR and read the results into
![Placing the digits of a number into a vector](https://blogs.sas.com/content/iml/files/2017/02/AdvancedAnalytics-3.png)
I enjoy reading about the Le Monde puzzles (and other topics!) at Christian Robert's blog. Recently he asked how to convert a number with s digits into a numerical vector where each element of the vector contains the corresponding digit (by place value). For example, if the number is 4321,
![Shorthand notation for row and column operations](https://blogs.sas.com/content/iml/files/2011/08/t_subscriptreduction.png)
The SAS/IML language enables you to perform matrix-vector computations. However, it also provides a convenient "shorthand notation" that enables you to perform elementwise operation on rows or columns in a natural way. You might know that the SAS/IML language supports subscript reduction operators to compute basic rowwise or columnwise quantities.