# Bayesian Analysis in SAS

**9/7/18**

I do Bayesian analyses for fun/knowledge, if required to, or if I need very strong, subjective modeling assumptions, especially for problems that have small sample sizes. As an aside, I don't really consider these solutions to be addressing "probability", but rather something like "chance", "uncertainty", or "belief". There are some exceptions, for example if they use a lot of data, use few and/or weak assumptions, and have good frequentist properties.

Anyway, it has become apparent to me that if you do a general search for software to do Bayesian analyses, you are likely to come across names like Stan, R, OpenBUGS, WinBUGS, JAGS, JASP, and maybe a few others. However, there is one yuge, glaring omission from this list, and that is SAS. I believe SAS is typically left off this list because SAS may be perceived as being software for doing "frequentist" statistics.

SAS has a history of being *that program you use for ANOVA*, and not one that you would use for statistical programming, at least that is my perception based on graduate school and industry (~15 years) experience. On the contrary, SAS actually has fantastic capabilities to carry out just about any analysis, including thorough Bayesian analyses.

For starters, Bayesian can be done in the following five procedures (and possibly more I'm leaving out). Each of these procedures has a ton of options (way too many for me to list) to fully customize a Bayesian analysis.

**PROC BCHOICE**- fits Bayesian discrete choice models by using MCMC methods

**PROC FMM**- fits finite mixture models

**PROC GENMOD**- fits generalized linear models

**PROC LIFEREG**- fits parametric models to survival data

**PROC PHREG**- performs regression analysis of survival data based on the Cox proportional hazards model

**PROC MCMC**- general purpose Markov Chain Monte Carlo simulation procedure designed to fit Bayesian models

Another possible reason why those wanting Bayesian analysis gravitate towards the aforementioned Bayesian software, is that graphs are very useful for Bayesian analysis, and back in the day SAS was not very good at making graphs. In fact, they were downright ugly and took a lot of code to make. In graduate school, we essentially used SAS for ANOVA and R for graphs. Times have changed however, and now graphs in SAS are beautiful and much easier to implement.

Be sure to check out the non-SAS software for Bayesian analysis, but personally, I am not too infatuated with many of them from what I've seen. Being free or open source *certainly* has pros, but also has cons, and the cons are rarely mentioned in articles discussing them.

Some obvious cons are

- here today, but gone tomorrow?
- "free" to the user does not mean no money is involved in the project (which could dry up)
- less users
- less support
- limited features
- nothing comes close to the coolness of SAS conferences such as the SAS user groups (NESUG, SESUG, etc.) and especially the SAS Global Forum.

SAS has a huge user base, tons of support, documentation, books, and experts, and has been around for at least twice as many __decades__ as its nearest competitor. Changes might be slower to get implemented, but I have at least an order of magnitude more confidence in it. I strongly recommend SAS for your Bayesian, and frequentist, analyses.

Here are a few good resources on Bayesian analysis using SAS

- An Introduction to Bayesian Analysis with SAS/STAT Software
- Practical Bayesian Computation using SAS
- Testing the Bayesian Suite of SAS Procedures using Ecological Data and Comparing Simulations with WinBUGS Bayesian Biopharmaceutical Applications using SAS
- Advanced Hierarchical Modeling with the MCMC Procedure
- Mixture Priors 101: Using SAS to Obtain Powerful Frequentist Inferences with Bayesian Methods
- Comparing Priors in Bayesian Logistic Regression for Sensorial Classification of Rice
- Bayesian Analysis of Survival Data with SAS PHREG Procedure

Thank you for reading.

If you enjoyed *any* of my content, please consider supporting it in a variety of ways:

- Email news@statisticool.com to sign up to receive news and updates
- Donate any amount via PayPal
- Take my Five Poem Challenge
- Buy ad space on Statisticool.com
- Buy what you need on Amazon using my affiliate link
- Follow me on Twitter here