The DO Loop
Statistical programming in SAS with an emphasis on SAS/IML programs![Extracting elements from a matrix: rows, columns, submatrices, and indices](https://blogs.sas.com/content/iml/files/2015/11/t_extract.png)
A matrix is a convenient way to store an array of numbers. However, often you need to extract certain elements from a matrix. The SAS/IML language supports two ways to extract elements: by using subscripts or by using indices. Use subscripts when you are extracting a rectangular portion of a
![Can't find that data? Search all variables in all data sets](https://blogs.sas.com/content/iml/files/2015/10/findvariables.png)
Sometimes I can't remember where I put things. If I lose my glasses or garden tools, I am out of luck. But when I can't remember where I put some data, I have SAS to help me find it. When I can remember the name of the data set, my
![Exact tests in PROC FREQ: What, when, and how](https://blogs.sas.com/content/iml/files/2017/01/AdvancedAnalytics-2.png)
Did you know that the FREQ procedure in SAS can compute exact p-values for more than 20 statistical tests and statistics that are associated with contingency table? Mamma mia! That's a veritable smorgasbord of options! Some of the tests are specifically for one-way tables or 2 x 2 tables, but many apply
![Tabulate counts when there are unobserved categories](https://blogs.sas.com/content/iml/files/2015/10/t_tabulatelevels.png)
Suppose that you are tabulating the eye colors of students in a small class (following Friendly, 1992). Depending upon the ethnic groups of these students, you might not observe any green-eyed students. How do you put a 0 into the table that summarizes the number of students who have each
![How to generate random integers in SAS](https://blogs.sas.com/content/iml/files/2011/08/generaterandom.png)
You can use SAS to generate random integers between 1–10 or in the range 1–100. This article shows how to generate random integers as easily as Excel does. I was recently talking with some SAS customers and I was asked "Why can't SAS create an easy way to generate random
![Ten "one-liners" that create test matrices for statistical programmers](https://blogs.sas.com/content/iml/files/2017/02/AdvancedAnalytics-3.png)
You've had a long day. You've implemented a custom algorithm in the SAS/IML language. But before you go home, you want to generate some matrices and test your program. If you are like me, you prefer a short statement—one line would be best. However, you also want the flexibility to