Statistics Examples

Here, on the statistics example page, I present code examples of common statistical tasks, that SAS handles smoothly both using the SAS/IML language and relevant statistical procedures. See the SAS/STAT Documentation Page to see what procedures are in the SAS/STAT package. Also, see my Probability Distribution Example Page to learn about common probability distributions often used in statistics. If you are not at all familiar with basic statistical analysis in SAS, go to my Learn SAS Programming page. Here, I recommend some great learning material to the beginner statistician in SAS.

Descriptive and Inferential Statistics

SAS provides many great tools to do both descriptive and inferential statistics. Here, I present examples of common statistical tasks that the SAS STAT procedures and the IML language handles easily.

Descriptive Statistics With PROC MEANS and SAS/IML

One Sample T Test

Two Sample T Test

F Test

Linear Modelling

Whether your goal is generalization through predictive modelling or to draw inferences based on samples, statisticians use linear modelling in many different applications both in the academic world and in various industries where SAS software is the industry standard tool. SAS provides numerous procedures designed of efficiently fitting various linear models.

A Simple Linear Regression Example

A Simple Logistic Regression Example


Finally, if you are interested in linear modelling, I highly recommend the book SAS For Linear Models. It covers a wide variety of both simple and complex linear models and how to fit them in SAS.


In addition to the examples above, see the blog post What SAS Books Are On My Shelf? to see what statistics books I recommend if you are interested in statistical analysis in SAS.

Finally, my blog also has a few code examples of statistical analysis in SAS. Go to the Statistics category to  see them all. Also check out the blog post about the SAS books on my shelf. Quite a few of them are in the field of statistics and very recommendable.