asdocx: Export from Stata to Word, Excel, LaTeX & HTML › Forums › asdocx Forum › asdocx for gsem output
Tagged: gsem
-
AuthorPosts
-
Hello,
I am currently trying to use asdocx with a gsem command but am getting an error.
The code I am running is:
asdocx gsem (i.predclass4 <- v2x_polyarchy gender X003 university i.X047 i.E023 i.F034 exclpop5 endogenous BQ GDPgrowth gini_disp v2x_corr i.amnesty wording M1[Country]), mlogit nocapslatent latent(M1) replace save(Tables/predclass) dec(3) fs(11) landscape table_layout(autofit) label
And I get the following error:
_chdir(): 3254 nonstring found where string required
get_file_and_folder(): – function returned error
<istmt>: – function returned error
r(3254);end of do-file
r(3254);
can you advise? Is it possible to use asdocx for gsem commands? I just updated asdocx to the most recent version
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. Thereplay
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
Perfect, I will give that a try! Thank you so much!
Is there a command/way to clear the asdocx replay?
When I run the gsem command and then asdocx replay the first time it works great but if I run a subsequent gsem command and try to use asdocx replay it outputs the data from the first gsem command.
Since we are using the nest option, all subsequent regressions are nested in the table. See this example:
sysuse auto, clear gsem (mpg <- weight c.weight#c.weight foreign) asdocx replay, nest replace gsem (mpg <- weight c.weight#c.weight ) asdocx replay, nest Table: Regression results 0 |1 2 3 ----+----------------------------------------------------------------------- 1 | (1) (2) ----+----------------------------------------------------------------------- 2 | mpg mpg 3 |weight -0.017*** -0.014*** 4 | (0.004) (0.004) 5 |c.weight#c.weight 0*** 0** 6 | (0) (0) 7 |foreign -2.204** 8 | (1.03) 9 |_cons 56.539*** 51.183*** 10 | (6.028) (5.65) 11 |/var(e.mpg) 10.193*** 10.823*** 12 | (1.676) (1.779) 13 |Observations 74 74 ---------------------------------------------------------------------------- Click to Open File: C:\temp\MyFile.docx
If you wish to start a new table, you can use the option
reset
asdocx replay, nest reset Table: Regression results 0 |1 2 3 ----+----------------------------------------------------------------------- 1 | (1) (2) ----+----------------------------------------------------------------------- 2 | mpg mpg 3 |weight -0.017*** -0.014*** 4 | (0.004) (0.004) 5 |c.weight#c.weight 0*** 0** 6 | (0) (0) 7 |foreign -2.204** 8 | (1.03) 9 |_cons 56.539*** 51.183*** 10 | (6.028) (5.65) 11 |/var(e.mpg) 10.193*** 10.823*** 12 | (1.676) (1.779) 13 |Observations 74 74 ---------------------------------------------------------------------------- Table: Regression results 0 |1 2 ----+----------------------------------------------------------------------- 1 | (1) ----+----------------------------------------------------------------------- 2 | mpg 3 |weight -0.014*** 4 | (0.004) 5 |c.weight#c.weight 0** 6 | (0) 7 |_cons 51.183*** 8 | (5.65) 9 |/var(e.mpg) 10.823*** 10 | (1.779) 11 |Observations 74 ----------------------------------------------------------------------------
-
AuthorPosts
- You must be logged in to reply to this topic.