The DO Loop
Statistical programming in SAS with an emphasis on SAS/IML programs![The knapsack problem: Binary integer programming in SAS/IML](https://blogs.sas.com/content/iml/files/2017/01/ProgrammingTips-2.png)
Many optimization problems in statistics and machine learning involve continuous parameters. For example, maximum likelihood estimation involves optimizing a log-likelihood function over a continuous domain, possibly with constraints. Recently, however, I had to solve an optimization problem for which the solution vector was a 0/1 binary variable. To solve the
![Logical negation of vectors](https://blogs.sas.com/content/iml/files/2017/01/ProgrammingTips-2.png)
In a matrix-vector language such as SAS/IML, it is useful to always remember that the fundamental objects are matrices and that all operations are designed to work on matrices. (And vectors, which are matrices that have only one row or one column.) By using matrix operations, you can often eliminate
![Choose samples with specified statistical properties](https://blogs.sas.com/content/iml/files/2021/10/BootTarget3-640x336.png)
A reader asked whether it is possible to find a bootstrap sample that has some desirable properties. I am using the term "bootstrap sample" to refer to the result of randomly resampling with replacement from a data set. Specifically, he wanted to find a bootstrap sample that has a specific
![Why you should visualize distributions instead of report means](https://blogs.sas.com/content/iml/files/2021/09/BoxStrip4-360x336.png)
Graphing data is almost always more informative than displaying a table of summary statistics. In a recent article about "dynamite plots," I briefly mentioned that graphs such as box plots and strip plots are better at showing data than graphs that merely show the mean and standard deviation. This article
![Use simulations to evaluate the accuracy of asymptotic results](https://blogs.sas.com/content/iml/files/2017/01/ProgrammingTips-2.png)
The field of probability and statistics is full of asymptotic results. The Law of Large Numbers and the Central Limit Theorem are two famous examples. An asymptotic result can be both a blessing and a curse. For example, consider a result that says that the distribution of some statistic converges
![Add an item to a sublist](https://blogs.sas.com/content/iml/files/2021/09/AddSubItem1-702x336.png)
The SAS/IML language supports lists, which are containers that store other objects, such as matrices and other lists. A primary use of lists is to pack objects of various types into a single symbol that can be passed to and from modules. A useful feature of using lists is that