asdocx: Export from Stata to Word, Excel, LaTeX & HTML › Forums › asdocx Forum › xtgcause not working with asdocx › Reply To: xtgcause not working with asdocx

The command xtgcause is not a Stata official command. Hence asdocx is not aware of that. The help file of xtgcause shows that the command leaves scalar in r(), and hence these can be written with flexmat and then exported with asdocx. Here is an example.

The dataset Data_demo.xls used in this example is provided by Dumitrescu and Hurlin at

http://www.runmycode.org/companion/view/42, along with a few results.

```
. import excel using Data_demo.xls, clear
. ren (A-J) x#, addnumber
. ren (K-T) y#, addnumber
. gen t = _n
. reshape long x y, i(t) j(id)
. xtset id t
. xtgcause y x, lag(1)
```

Now create the table from the scalars with flexmat

flexmat reset flexmat addrow, data(Lag order, `r(lags)', \empty, \empty) row(1) flexmat addrow, data(W-bar, `r(wbar)', \empty, \empty) row(2) dec(3) flexmat addrow, data(Z-bar, `r(zbar)', p-value, `r(zbar_pv)') row(3) dec(3) flexmat addrow, data(Z-bar tilde, `r(zbart)', p-value, `r(zbart_pv)') row(4) dec(3) asdocx export

**Table: Results**

Lag order | 1 | ||
---|---|---|---|

W-bar | 1.291 | ||

Z-bar | 0.650 | p-value | 0.515 |

Z-bar tilde | 0.259 | p-value | 0.796 |