Dr. Attaullah Shah
Keymaster
Post count: 106

gsem suit of commands have a challenging syntax structure and hence cannot be directly used with asdocx. However, there is a workaround. Once the gsem command is executed, we can export its output in the next step using asdocx. See the following example, I am using the special replay command with asdocx. The replay is useful in all other situations as well when the syntax structure is complex.

sysuse auto
gsem (mpg <- weight c.weight#c.weight foreign)
asdocx replay, nest replace
  0 |1                                                       2 
----+-----------------------------------------------------------------------------
  1 |                                                      (1) 
----+-----------------------------------------------------------------------------
  2 |                                                      mpg 
  3 |weight                                          -0.017*** 
  4 |                                                  (0.004) 
  5 |c.weight#c.weight                                    0*** 
  6 |                                                      (0) 
  7 |foreign                                          -2.204** 
  8 |                                                   (1.03) 
  9 |_cons                                           56.539*** 
 10 |                                                  (6.028) 
 11 |/var(e.mpg)                                     10.193*** 
 12 |                                                  (1.676) 
 13 |Observations                                           74 
----------------------------------------------------------------------------------
Click to Open File:  C:\temp\MyFile.docx