The DO Loop
Statistical programming in SAS with an emphasis on SAS/IML programs![What is rank correlation?](https://blogs.sas.com/content/iml/files/2017/01/ProgrammingTips-2.png)
When someone refers to the correlation between two variables, they are probably referring to the Pearson correlation, which is the standard statistic that is taught in elementary statistics courses. Elementary courses do not usually mention that there are other measures of correlation. Why would anyone want a different estimate of
![Robust principal component analysis in SAS Classical and robust principal component scores for crime data, computed in SAS](https://blogs.sas.com/content/iml/files/2017/08/robustPCA13-640x336.png)
Recently, I was asked whether SAS can perform a principal component analysis (PCA) that is robust to the presence of outliers in the data. A PCA requires a data matrix, an estimate for the center of the data, and an estimate for the variance/covariance of the variables. Classically, these estimates
![The curse of non-unique eigenvectors](https://blogs.sas.com/content/iml/files/2017/01/ProgrammingTips-2.png)
A SAS customer asked, "I computed the eigenvectors of a matrix in SAS and in another software package. I got different answers? How do I know which answer is correct?" I've been asked variations of this question dozens of times. The answer is usually "both answers are correct." The mathematical
![Dimension reduction: Guidelines for retaining principal components Broken-stick method for retaining principal components](https://blogs.sas.com/content/iml/files/2017/07/PCAbrokenstiick3-640x336.png)
Last week I blogged about the broken-stick problem in probability, which reminded me that the broken-stick model is one of the many techniques that have been proposed for choosing the number of principal components to retain during a principal component analysis. Recall that for a principal component analysis (PCA) of
![Flip it. Flip it good.](https://blogs.sas.com/content/iml/files/2017/01/ProgrammingTips-2.png)
A SAS user needed to convert a program from MATLAB into the SAS/IML matrix language and asked whether there is a SAS/IML equivalent to the fliplr and flipud functions in MATLAB. These functions flip the columns or rows (respectively) of a matrix; "LR" stands for "left-right" and "UD" stands for
![Random segments and broken sticks Broken stick problem: What is the probability that three randomly chosen points will break a segment into a triangle?](https://blogs.sas.com/content/iml/files/2017/07/brokenstick1.png)
A classical problem in elementary probability asks for the expected lengths of line segments that result from randomly selecting k points along a segment of unit length. It is both fun and instructive to simulate such problems. This article uses simulation in the SAS/IML language to estimate solutions to the