Tables for sem in Stata

stats
workflow
Stata
Author

Andy Grogan-Kaylor

Published

June 1, 2025

Introduction

A quick demo of making tables with sem in Stata.

Get Data

Data from Multilevel Thinking

use "simulated_multilevel_data.dta", clear

Run sem Model

Outcome is a function of physical punishment, parental warmth and the intervention. Physical punishment is potentially an outcome of the intervention.

I use quietly to suppress the outcome from the sem command

quietly: sem (outcome <- physical_punishment warmth intervention) ///
(physical_punishment <- intervention) // sem model

est store M1 // store estimates from this model

Make Table With etable

As long as the variables have variable labels, etable (with a few options) will automatically make a nice regression table.

etable, ///
estimates(M1) /// using these estimates 
showstars showstarsnote /// show significance stars & note
showeq // show equations
Running /Users/agrogan/Desktop/GitHub/agrogan1.github.io/posts/tables-SEM/profi

> le.do ...



---------------------------------------------
                                        1    
---------------------------------------------
beneficial outcome                           
  physical punishment in past week  -0.942 **
                                   (0.083)   
  parental warmth in past week       0.836 **
                                   (0.060)   
  recieved intervention              0.671 **
                                   (0.227)   
  Intercept                         51.500 **
                                   (0.338)   
physical punishment in past week             
  recieved intervention             -0.051   
                                   (0.050)   
  Intercept                          2.504 **
                                   (0.035)   
/                                            
  var(e.outcome)                    38.434   
                                   (0.992)   
  var(e.physical_punishment)         1.851   
                                   (0.048)   
Number of observations                3000   
---------------------------------------------
** p<.01, * p<.05