Hi Statalist Members,

I am using the following code to run some mediation analyses (single mediator) to my entire sample. I wondered whether it is possible to do a mediation analysis to a subsample of the same sample in Stata? I am using Stata 17.

sem (X -> M Y) (M -> Y)

Thank you.