The DO Loop
Statistical programming in SAS with an emphasis on SAS/IML programs![Create a response variable that has a specified R-square value](https://blogs.sas.com/content/iml/files/2020/12/ProjRSq1-702x336.png)
When you perform a linear regression, you can examine the R-square value, which is a goodness-of-fit statistic that indicates how well the response variable can be represented as a linear combination of the explanatory variables. But did you know that you can also go the other direction? Given a set
![Find a vector that has a specified correlation with another vector](https://blogs.sas.com/content/iml/files/2020/12/ProjCorr1-702x336.png)
Do you know that you can create a vector that has a specific correlation with another vector? That is, given a vector, x, and a correlation coefficient, ρ, you can find a vector, y, such that corr(x, y) = ρ. The vectors x and y can have an arbitrary number
![Segmented regression models in SAS](https://blogs.sas.com/content/iml/files/2020/12/SegReg4-640x336.png)
A segmented regression model is a piecewise regression model that has two or more sub-models, each defined on a separate domain for the explanatory variables. For simplicity, assume the model has one continuous explanatory variable, X. The simplest segmented regression model assumes that the response is modeled by one parametric
![Horn's method: A simulation-based method for retaining principal components](https://blogs.sas.com/content/iml/files/2020/12/HornsMethod4-640x336.png)
One purpose of principal component analysis (PCA) is to reduce the number of important variables in a data analysis. Thus, PCA is known as a dimension-reduction algorithm. I have written about four simple rules for deciding how many principal components (PCs) to keep. There are other methods for deciding how
![Can you transplant an indoor Christmas tree?](https://blogs.sas.com/content/iml/files/2020/12/XmasTreeLD3-640x336.png)
"O Christmas tree, O Christmas tree, how lovely are your branches!" The idealized image of a Christmas tree is a perfectly straight conical tree with lush branches and no bare spots. Although this ideal exists only on Christmas cards, forest researchers are always trying to develop trees that approach the
![How to score a logistic regression model that was not fit by PROC LOGISTIC](https://blogs.sas.com/content/iml/files/2020/11/MILogistic3-640x336.png)
A SAS customer asked a great question: "I have parameter estimates for a logistic regression model that I computed by using multiple imputations. How do I use these parameter estimates to score new observations and to visualize the model? PROC LOGISTIC can do the computation I want, but how do