Announcement

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

  • asdoc for a two-way table and chi2

    Hi there,

    I am trying to use asdoc to export my chi-square tests outputs to word. Unfortunately, it looks like chi2 is not supported by asdoc.
    My very simple code is the following:

    Code:
    asdoc tab age treatment, col chi replace title(Chi-squared test for age by treatment condition)
    Is there a way to add the value of my chi2-test statistic plus the p-value to the output table? If not, is there a way to add a note (I tried but I failed to do so until now..) under the table with such information?


    Sincerely
    Mattia

  • #2
    Hi Mattia,

    if you might want to use "table" instead, maybe this example by Jeff Pitblado helps?

    HTML Code:
    https://www.statalist.org/forums/forum/general-stata-discussion/general/1733907-i-have-a-question-about-the-new-dtable-command
    Last edited by Simon Pfaff; 25 Oct 2024, 02:33.

    Comment


    • #3
      In the last several years, I have shifted my development focus to asdocx, which has now evolved into a more refined product. However, asdoc continues to serve a wide range of academic publication purposes. For the problem at hand, you can store the Chi-squared and its p-value in macros and send these macros to the Word document using the text option of asdoc. Please see the following examples.
      Code:
      sysuse auto
      asdoc tab foreign rep78, chi replace
      loc chi : di %9.3f = `r(chi2)'
      loc p : di %9.3f = `r(p)'
      asdoc, text(Chi = `chi' ; P-value = `p')
      Click image for larger version

Name:	Capture.JPG
Views:	1
Size:	52.0 KB
ID:	1766416


      Example using asdocx
      Code:
      asdocx tab foreign rep78, chi replace
      Click image for larger version

Name:	Capture.JPG
Views:	1
Size:	52.9 KB
ID:	1766417



      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


      • #4
        Thanks a lot to you both for the valuable suggestions!


        Sincerely
        Mattia

        Comment

        Working...
        X