The DO Loop
Statistical programming in SAS with an emphasis on SAS/IML programs![How to compute the distance between observations in SAS](https://blogs.sas.com/content/iml/files/2013/03/t_distance.png)
In statistics, distances between observations are used to form clusters, to identify outliers, and to estimate distributions. Distances are used in spatial statistics and in other application areas. There are many ways to define the distance between observations. I have previously written an article that explains Mahalanobis distance, which is
![Understanding ridge regression in SAS](https://blogs.sas.com/content/iml/files/2013/03/t_ridgereg.png)
Someone recently asked a question on the SAS Support Communities about estimating parameters in ridge regression. I answered the question by pointing to a matrix formula in the SAS documentation. One of the advantages of the SAS/IML language is that you can implement matrix formulas in a natural way. The
![The case of spilled coffee and the regression intercept](https://blogs.sas.com/content/iml/files/2013/03/missingintercept.png)
Argh! I've just spilled coffee on output that shows the least squares coefficients for a regression model that I was investigating. Now the parameter estimate for the intercept is completely obscured, although I can still see the parameter estimates for the coefficients of the continuous explanatory variable. What can I
![Construct normal data from summary statistics](https://blogs.sas.com/content/iml/files/2013/03/constructnormaldatatomatch.png)
Last week there was an interesting question posted to the "Stat-Math Statistics" group on LinkedIn. The original question was a little confusing, so I'll state it in a more general form: A population is normally distributed with a known mean and standard deviation. A sample of size N is drawn
![How to use PROC SGPLOT to display the slope and intercept of a regression line](https://blogs.sas.com/content/iml/files/2013/02/RegSlopeInt.png)
A SAS user asked an interesting question on the SAS/GRAPH and ODS Graphics Support Forum. The question is: Does PROC SGPLOT support a way to display the slope of the regression line that is computed by the REG statement? Recall that the REG statement in PROC SGPLOT fits and displays
![Initializing vectors by using repetition factors](https://blogs.sas.com/content/iml/files/2017/02/AdvancedAnalytics-4.png)
The SAS/IML language has a curious syntax that enables you to specify a "repetition factor" when you initialize a vector of literal values. Essentially, the language enables you to specify the frequency of an element. For example, suppose you want to define the following vector: proc iml; x = {1