Demonstration of the mediate command in Stata 18 for causal mediation analysis. Specify a variety of models for the outcome and mediator, and report potential outcome means, direct effects, indirect effects, and total effect.
https://www.stata.com