BookmarkSubscribeRSS Feed

Modeling Causal Effects Using SAS/STAT®

Started ‎03-15-2021 by
Modified ‎05-07-2021 by
Views 1,510
Paper 1151-2021


 John Amrhein, McDougall Scientific




Run this Notebook


 Download this Notebook



An outcome causally depends on a prior event if and only if the occurrence of the prior event implies that the outcome will occur, and the absence of the prior event implies that the outcome will not occur. The fundamental problem of causality is that, at an individual level, the prior event is either observed or not, and the alternative can only be imagined. Therefore, we restrict causal analyses to population level relationships. To establish a causal relationship, we must isolate the prior event and the outcome from other possible causal prior events. We do this by intervening in the world we are measuring, perhaps by designed experimentation. However, designed experiments are not practical or even possible in some situations and an alternative method to establish causal relationships is needed.


This paper introduces structural causal modeling, an anlytical method that supports causal inference. A structural causal model is a set of pre-specified relationships between variables, usually represented graphically, that satisfy a set of conditions allowing causal inference. This paper introduces 1) graphical models, specifically directed acyclic graphs (DAGs), 2) the concept of identifiability, which allows causal inference, and 3) parameter estimation for the identified model. We use the CAUSAL family of procedures in SAS/STAT: CAUSALGRAPH, CAUSALMED, and CAUSALTRT.


Watch the presentation

Watch Modeling Causal Effects using SAS/STAT as presented by the author on the SAS Users channel on YouTube.




This paper is a gentle introduction to causality and structural causal models. The first step in a causal analysis using structural causal models is to draw your system of variables in a directed acyclic graph. Then code your DAG in PROC CAUSALGRAPH to identify adjustment sets of confounders that you must control in your causal analysis. With an adjustment set identified, if you can satisfy the four assumptions and if you practice good modeling principles, then you can safely make causal inferences.


We introduced to modeling procedures, PROC CAUSALMED, for mediation analyses, and PROC CAUSALTRT, for estimates of average treatment effect. PROC CAUSALTRT provides two modeling approaches; modeling the treatment by fitting a propensity score model, and modeling the outcome by fitting a structural causal model.



Amrhein, J. and Wang F. (2018). “Bayesian Concepts: An Introduction.” Paper 1863-2018. In Proceedings of the SAS Global Forum 2018 Conference. Cary, NC: SAS Institute Inc.

Fechtner, S. (2018). “The Propensity Score Matching.” Paper RW03. In Proceedings of the PhUSE EU Connect 2018 Conference.

Greenland, S. and Robins, J. (2009). Identifiability, Exchangeability, and Confounding Revisited. Epidemiologic Perspectives & Innovations, 6:4.

Lamm, M. and Yung, Y-F. (2017). “Estimating Causal Effects from Observational Data with the CAUSALTRT Procedure” Paper SAS374-2017. In Proceedings of the SAS Global Forum 2017 Conference. Cary, NC: SAS Institute Inc.

Lamm, M., Thompson, C., and Yung, Y-F. (2019). “Building a Propensity Score Model with SAS/STAT® Software: Planning and Practice.” Paper 3056-2019. In Proceedings of the SAS Global Forum 2019 Conference. Cary, NC: SAS Institute Inc.

Madhanagopal, B. and Amrhein, J. (2019). “Analyzing Structural Causal Models Using the CALIS Procedure.” Paper 3765-2019. In Proceedings of the SAS Global Forum 2019 Conference. Cary, NC: SAS Institute Inc.

Pearl, J., Glymour, M., and Jewell, N. (2016). Causal Inference in Statistics: A Primer. John Wiley & Sons Ltd.

Schafer, J. and Kang, J. (2008). Average Causal Effects from Nonrandomized Studies: A Practical Guide and Simulated Example. Psychological Methods, Vol. 13, No. 4, 279-313.

Thompson, C. (2019). “Causal Graph Analysis with the CAUSALGRAPH Procedure.” Paper SAS2998-2019. In Proceedings of the SAS Global Forum 2019 Conference. Cary, NC: SAS Institute Inc.

Yung, Y-F., Lamm, M., and Zhang, W. (2018). “Causal Mediation Analysis with the CAUSALMED Procedures.” Paper SAS1991-2018. In Proceedings of the SAS Global Forum 2018 Conference. Cary, NC: SAS Institute Inc.



The author sincerely thanks Clay THompson of SAS Institute Inc. for his suggestions to improve an earlier version of this paper.


Pearl, J. and Mackenzie, D. (2018). The Book of Why: The New Science of Cause and Effect. Basic Books. New York, NY.



Your comment and questions are valued and encouraged. Contact the author at:

       John Amrhein
       Vice President, Managing Director
       McDougall Scientific Ltd.


SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.


Other brand and product names are trademarks of their respective companies.


Do we have a visual interface for drag and drop preparing the graph?

In JMP we had this but in VA or VS not sure...

Hi @Atabarut ,

Thanks for visiting the SAS Community, reading the article, and posting your question. I'd recommend posting this question in a thread on the Visual Analytics board. Please make sure to reference this article.




Version history
Last update:
‎05-07-2021 02:38 PM
Updated by:



Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

Get the $99 certification deal.jpg



Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Article Tags