The DO Loop
Statistical programming in SAS with an emphasis on SAS/IML programs![Teaching an AI assistant to read and write SAS IML vectors](https://blogs.sas.com/content/iml/files/2024/06/TeachAI-512x336.png)
One of the most exciting features of SAS Viya Workbench is that the code editor includes a generative AI component called SAS Viya Copilot. This feature was announced and demonstrated at SAS Innovate 2024. With the Copilot, you can specify a text prompt that generates SAS code. For example, you
![Scale a density curve to match a histogram](https://blogs.sas.com/content/iml/files/2024/06/densityHist1-640x336.png)
This article discusses how to scale a probability density curve so that it fits appropriately on a histogram, as shown in the graph to the right. By definition, a probability density curve is scaled so that the area under the curve equals 1. However, a histogram might show counts or
![A bootstrap confidence interval for an R-square statistic](https://blogs.sas.com/content/iml/files/2024/06/RSqCI2-640x336.png)
A previous article discusses a formula for a confidence interval for R-square in a linear regression model (Olkin and Finn (1995) "Correlations redux", Psychological Bulletin) The formula is useful for large data sets, but should be used with caution for small samples. At the end of the previous article, I
![The distribution of the R-square statistic](https://blogs.sas.com/content/iml/files/2024/06/CIRsq3-640x336.png)
A SAS analyst ran a linear regression model and obtained an R-square statistic for the fit. However, he wanted a confidence interval, so he posted a question to a discussion forum asking how to obtain a confidence interval for the R-square parameter. Someone suggested a formula from a textbook (Cohen,
![Visualize a multivariate regression model when using spline effects](https://blogs.sas.com/content/iml/files/2024/06/vizSpline4-640x336.png)
A SAS analyst read my previous article about visualizing the predicted values for a regression model that uses spline effects. Because the original explanatory variable does not appear in the model, the analyst had several questions: How do you score the model on new data? The previous example has only
![Find the label of a variable in SAS](https://blogs.sas.com/content/iml/files/2024/05/vlabel1.png)
Sometimes labels for variables get "dropped" during data preparation and cleaning. One example is when data are transposed from "wide form" to "long form." For example, suppose a data set has three variables, X, Y, and Z, each with labels. If you transpose the data to long form, the new