The DO Loop
Statistical programming in SAS with an emphasis on SAS/IML programs![Excluding variables: Read all but one variable into a matrix](https://blogs.sas.com/content/iml/files/2015/09/t_excludereadvar1.png)
Dear Rick, I have a data set with 1,001 numerical variables. One variable is the response, the others are explanatory variable. How can I read the 1,000 explanatory variables into an IML matrix without typing every name? That's a good question. You need to be able to perform two sub-tasks:
![Plot the conditional distribution of the response in a linear regression model](https://blogs.sas.com/content/iml/files/2015/09/GLM_normal_identity.png)
A friend who teaches courses about statistical regression asked me how to create a graph in SAS that illustrates an important concept: the conditional distribution of the response variable. The basic idea is to draw a scatter plot with a regression line, then overlay several probability distributions along the line,
![Those tricky PERCENT formats](https://blogs.sas.com/content/iml/files/2015/07/t_percent.png)
When using SAS to format a number as a percentage, there is a little trick that you need to remember: the width of the formatted value must include room for the decimal point, the percent sign, and the possibility of two parentheses that indicate negative values. The field width must
![Where did it come from? Adding the source of each observation to a SAS data set](https://blogs.sas.com/content/iml/files/2015/08/t_indsname1.png)
Imagine the following scenario. You have many data sets from various sources, such as individual stores or hospitals. You use the SAS DATA step to concatenate the many data sets into a single large data set. You give the big data set to a colleague who will analyze it. Later
![Convert a vector to a string](https://blogs.sas.com/content/iml/files/2015/07/vectortostring.png)
Base SAS contains many functions for processing strings, and you can call these functions from within a SAS/IML program. However, sometimes a SAS/IML programmer needs to process a vector of strings. No problem! You can call most Base SAS functions with a vector of parameters. I have previously written about
![Create a density curve with shaded tails](https://blogs.sas.com/content/iml/files/2015/07/colordensitytails.png)
A SAS programmer wanted to plot the normal distribution and highlight the area under curve that corresponds to the tails of the distribution. For example, the following plot shows the lower decile shaded in blue and the upper decile shaded in red. An easy way to do this in SAS