Forum Replies Created
-
AuthorPosts
-
in reply to: use asdocx with tabm command #15910
tabm
is a community contributed command. asdoc does not have any specific routine to create output file from this command. It just converts the log output to MS Word. On the other hand, asdocx has a built-in routine for creating such tables. Intead of usingtabm
command, you shall need to use thetabmany
. See this Statalist post where I has shown an example of how to use tabmanyin reply to: Blue screen problem #15907This is a rare occurrence. Seems your version of Stata has problem running the compiled Mata code. I have re-compiled the function and uploaded to the server. Please take the following steps and see if it can resolve the issue.
1. First update asdocx
asdocx_update
2. restart and see whether the problem is resolved
3. If not then please update Stata to version 15.1 (Since you have Stata 15, the update is free), and check whether it resolves the issue.
4. If the issue is still not resolved, then run the following code and send its log to me.
set trace on log using "asdocx.smcl" sysuse auto, clear asdocx tab foreign rep78, replace log close set trace off
It will generate a file with
asdocx.smcl
in the current directory, please send this file to me.As mentioned in the help file of asdocx, you can use the
reset
option to start a new table in the same document.syuse auto, clear asdocx reg foreign price mpg trunk weight, nest replace asdocx reg foreign price mpg trunk , nest reset
Thanks for your feedback. In the reg1 template, the decimal points of the p-values can be controlled with the
dect()
option. For the rest of the table, you can usedec()
option. See the following examplesysuse auto, clear asdocx logit foreign price mpg trunk weight, template(reg1) replace dect(3) dec(2)
Hello Lee,
Can you please provide the code you are using. From asdocx help file, I have tried the following code and it works fine.sysuse auto, clear asdocx ttest rep78==0, replace title(T-test results : mean == 0) asdocx ttest price==0, rowappend asdocx ttest mpg==0, rowappend asdocx ttest turn==0, rowappend asdocx ttest weight==0, rowappend asdocx ttest length==0, rowappend
using
rowappend
withby()
optionasdocx ttest mpg, by(foreign) replace asdocx ttest mpg, by(foreign) rowappend asdocx ttest price , by(foreign) rowappend 0 |1 2 3 4 5 6 7 8 9 ----+------------------------------------------------------------------------------------------- 1 | obs1 obs2 Mean1 Mean2 dif St_Err t_value p_value ----+------------------------------------------------------------------------------------------- 2 |mpg by foreign: 0 1 52 22 19.827 24.773 -4.946 1.362 -3.65 0.001 3 |mpg by foreign: 0 1 52 22 19.827 24.773 -4.946 1.362 -3.65 0.001 4 |price by foreign: ~1 52 22 6072.423 6384.682 -312.259 754.449 -0.4 0.68 ------------------------------------------------------------------------------------------------
I have added the bysort and by options for nested regressions. First update asdocx. One example is presented below:
asdocx_update * Use grunfeld dataset webuse grunfeld * Just keep 5 companies in the dataset and then estimate regression for each company keep if company < 6 * Note the bys company bys company : asdocx reg invest mvalue kstock, nest replace Table: Regression results 0 |1 2 3 4 5 6 ----+---------------------------------------------------------------------------------------------------------- 1 | (1) (2) (3) (4) (5) ----+---------------------------------------------------------------------------------------------------------- 2 | 1 2 3 4 5 3 |mvalue 0.118*** 0.118*** 0.118*** 0.118*** 0.118*** 4 | (0.009) (0.009) (0.009) (0.009) (0.009) 5 |kstock 0.256*** 0.256*** 0.256*** 0.256*** 0.256*** 6 | (0.039) (0.039) (0.039) (0.039) (0.039) 7 |_cons -63.611*** -63.611*** -63.611*** -63.611*** -63.611*** 8 | (22.376) (22.376) (22.376) (22.376) (22.376) 9 |Observations 100 100 100 100 100 10 |R-squared 0.761 0.761 0.761 0.761 0.761 ---------------------------------------------------------------------------------------------------------------
I have now updated asdocx. You can now use bysort or by() with tabulate command. Here is an example:
asdocx_update sysuse auto, clear by foreign : asdocx tab rep78, replace Tabulation of rep78 when foreign is Domestic 0 |1 2 3 4 ----+----------------------------------------------------------------------------- 1 |Repair record 1978 Freq. Percent Cum. ----+----------------------------------------------------------------------------- 2 |1 2 4.17 4.17 3 |2 8 16.67 20.83 4 |3 27 56.25 77.08 5 |4 9 18.75 95.83 6 |5 2 4.17 100.00 7 | Total 48 100.00 ---------------------------------------------------------------------------------- Tabulation of rep78 when foreign is Foreign 0 |1 2 3 4 ----+----------------------------------------------------------------------------- 1 |Repair record 1978 Freq. Percent Cum. ----+----------------------------------------------------------------------------- 2 |3 3 14.29 14.29 3 |4 9 42.86 57.14 4 |5 9 42.86 100.00 5 | Total 21 100.00 ---------------------------------------------------------------------------------- Click to Open File: C:\temp\test2.docx
I am not clear on your query related to labels. For me the lables works correctly. You must use the option
label
to export variable labels.asdocx sum price mpg rep78 headroom , detail stat(count mean sd var cv p50 skewness) /// title(something in danish) font(arial) dec(2) replace save(test2.docx) tzok label
in reply to: Trailing zeros but only for certain columns #15883You can control decimal points for each column separately using the option
c#_dec()
. The#
is column number anddec(#)
sets the decimal points. In your case, count and p50 are in column 2 and 7, therefore, we shall usec2_dec(0)
andc7_dec(0)
. Since you wish to report zero decimal points in these columns, therefore we shall usedec(0)
.sysuse auto, clear bysort foreign : asdocx sum price , detail stat(count mean sd var cv p50 skewness) /// title(title) font(Arial) dec(2) replace tzok c2_dec(0) c7_dec(0) 0 |1 2 3 4 5 6 7 8 ----+------------------------------------------------------------------------------------------ 1 |foreign N mean sd variance cv Median skewness ----+------------------------------------------------------------------------------------------ 2 |Domestic 52 6072.42 3097.10 9592054.92 0.51 4783 1.78 3 |Foreign 22 6384.68 2621.92 6874438.70 0.41 5759 1.22 ------------------------------------------------------------------------------------------------
in reply to: asdocx for gsem output #15878Since 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 ----------------------------------------------------------------------------
in reply to: asdocx for gsem output #15872gsem 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
in reply to: Adding column to table #15867Hello Rune
Welcome to asdocx forum. I think you need some sort of a customized table, for which flexmat is a good choice. flexmat is part of the asdocx package and it is already installed if you have asdocx. There are several examples where I show how to make tables with flexmat, or modify tables that are already made by asdocx. References to these resources are given below. Please note the optiontranspose
, it changes the table layout from wide to long.1. Introduction to flexmat : [ view post here ]
2. Add a Stata matrix to existing asdocx table [view post here ]
3. Create tables by cells, rows, or columns [ YouTube Video ]
To give a quick start for your desired solution, let me present the following code:
* Load some example data sysuse bpwide * Create statistics with asdocx asdocx sum bp_before bp_after, stat(count mean sd var p50 skewness) replace transpose 0 |1 2 3 ----+----------------------------------------------------------------------------- 1 |Variables bp before bp after ----+----------------------------------------------------------------------------- 2 |N 120 120 3 |Mean 156.45 151.35833 4 |Std. Dev. 11.38985 14.17762 5 |variance 129.72857 201.00497 6 |Median 154.5 149.5 7 |skewness 0.54729 0.38843 ---------------------------------------------------------------------------------- * Conduct a two sample t-test ttest bp_before == bp_after * The p-value from the t-test can now be appended to row 8 of the table created by asdoc flexmat addrow, data(p-value, `r(p)') row(8) dec(4) Table: Summary Statistics 0 |1 2 3 ----+----------------------------------------------------------------------------- 1 |Variables bp before bp after ----+----------------------------------------------------------------------------- 2 |N 120 120 3 |Mean 156.45 151.35833 4 |Std. Dev. 11.38985 14.17762 5 |variance 129.72857 201.00497 6 |Median 154.5 149.5 7 |skewness 0.54729 0.38843 8 |p-value 0.0011 ---------------------------------------------------------------------------------- * Export the new table to MS Word asdocx export
in reply to: flexmat_to_excel error when using table1 template #15865Hello Kan Wang
Seems you have updated asdocx after a long time. The reason you are getting this error is that theasdocx_update
command had a bug, it did not include a code to update the flexmat_to_excel program. This is now fixed. Just once you need the following code, and after that, you can use the usualasdocx_update
command to update asdocx.net install asdocx, from(http://fintechprofessor.com) replace
I have updated asdocx. The table title can now be split into multiple lines. To do so, add the control word
\cr
in the table titleasdocx_update asdocx sum ri B1 B2 B3 , title(First title \cr Second title \cr Third Title) replace title_align(center)
in reply to: Combine asdocx output with putdocx #15842If you want to write formatted text to the same document, you can use asdocx for that. See the following example where I add heading 1 and heading 2 using asdocx, and then add two regressions to the same file.
sysuse auto asdocx, text(Normal input cost) h1 replace asdocx, text ("Case one: Unit cost versus Cumulative Consumption (MWA)") h2 asdocx reg mpg rep78 headroom trunk weight, nest asdocx reg mpg rep78 headroom weight, nest
Hello Aduba Joseph
* asdocx: June 19, 2021: Version 1.6.6
I have added notes to nested regression. Nested regression now automatically reports notes in the table footer concerning either standard errors, robust standard errors, t-values or p-values, as the case may be. To get the updated version, type:
asdocx_update
In addition to the default notes, if you want to append additional notes, you can use the
notes(text)
option. For example,asdocx reg price mpg trunk, robust nest notes(The data source is auto.dta dataset)
-
AuthorPosts