Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Asdoc makes cell breaks for each blank space in headings and label names

    Hi!

    I find the asdoc command very helpful.
    BUT, for some reason, the resulting tables in word make a cell break for each blankspace.

    This applies both to the automatic headings such as 95% confidence interval,
    and to the text labels of categories in my categorical variables, when they consist of more than one word

    Example:
    Code:
    sysuse auto
    encode make, gen(makeNUM)
    asdoc proportion makeNUM, percent save(filename)  replace
    My results are along the line of the below screendump.
    I get similar results with other commands, and also if I specify the file extension as .doc or .rtf.
    I have STATA 18 and the latest version of Word.
    The biggest problem is when category names have different lengths, then the cells end up being unaligned.
    Click image for larger version

Name:	example asdoc screendump.png
Views:	1
Size:	46.9 KB
ID:	1777078

  • #2
    I do not use asdoc (from SSC), but in case you do not get a reply here, you may want to email the author. With Stata 18, you could get the wanted table using collect. Here is some technique:

    Code:
    sysuse auto, clear
    encode make, gen(makeNUM)
    collect clear
    proportion makeNUM, percent
    
    foreach stat in b se ul ll{
        collect get `stat' = r(table)["`stat'", 1...], tags(var[`stat'])
    }
    collect style cell var, nformat("%9.3f")
    collect label levels var b "Percent"
    collect label levels var se "Std. err."
    collect label levels var ll "Lower 95% CI"
    collect label levels var ul "Upper 95% CI"
    collect layout (colname) (var[b se ll ul])
    collect export mytable, as(docx) replace
    Click image for larger version

Name:	Capture.PNG
Views:	1
Size:	93.4 KB
ID:	1777091

    Comment


    • #3
      asdoc does not have a built-in routine for exporting the proportions table. Instead, asdoc constructs the table by capturing the log output generated by Stata’s proportion command. However, this approach may encounter limitations or inconsistencies in certain cases, as the user has noted.

      These limitations have been addressed in asdocx, which offers native support for exporting proportions tables directly, without relying on parsing the log output.
      Code:
      sysuse auto
      encode make, gen(makeNUM)
      asdocx proportion makeNUM, save(filename)  replace
      Click image for larger version

Name:	Capture.JPG
Views:	1
Size:	120.8 KB
ID:	1777116
      Regards
      --------------------------------------------------
      Attaullah Shah, PhD.
      Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
      FinTechProfessor.com
      https://asdocx.com
      Check out my asdoc program, which sends outputs to MS Word.
      For more flexibility, consider using asdocx which can send Stata outputs to MS Word, Excel, LaTeX, or HTML.

      Comment

      Working...
      X