Announcement

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

  • help exporting lstat results after logistic regression into word/excel documents

    hi all,
    does anyone know of a way to export the results of lstat into a word document or a table/excel?
    I have tried using outreg2 and asdoc but all this does is exports the logistic regression results ive performed to the documents and it ignores the lstat results.
    grateful for any help,
    thank you

  • #2
    The lstat command leaves behind a matrix and several scalars , which you can export to word with asdoc. For example, to export the classification table, you can use this code:

    Code:
    ssc install asdoc
    webuse lbw
    
    logistic low age lwt i.race smoke ptl ht ui
    
    lstat
    
    mat t = r(ctable)
    
    asdoc wmat, mat(t) replace
    Click image for larger version

Name:	Capture.PNG
Views:	1
Size:	9.0 KB
ID:	1570631



    To export various statistics from the lstat command, you can use the option row() of asdoc.
    For example:
    Code:
    * Get the required statistics and store them in macros, using three decimal points
    lstat
    loc sensetivity : di %9.3f = `r(P_p1)'
    loc Specificity : di %9.3f = `r(P_n0)'
    loc pp : di %9.3f = `r(P_1p)'
    loc np : di %9.3f = `r(P_0n)'
    
    * Export with asdoc
    
    * Create title row
    asdoc, row(Classified, Probability) replace title(My Table)
    asdoc, row(Sensitivity, `sensetivity')
    asdoc, row(Specificity, `Specificity')
    asdoc, row(Positive predictive value, `pp')
    asdoc, row(Negative predictive value, `np')
    Click image for larger version

Name:	Capture.PNG
Views:	1
Size:	19.6 KB
ID:	1570632



    Here are two more examples using option row()
    https://fintechprofessor.com/2018/09...stata-ms-word/

    https://fintechprofessor.com/2019/09...f-asdoc-stata/



    asdocx is now available
    A more powerful and flexible version of asdoc is now available. I call it asdocx. You may like to check the details here

    https://fintechprofessor.com/asdocx


    Please do remember to cite asdoc. To cite:

    In-text citation
    Tables were created using asdoc, a Stata program written by Shah (2018).

    Bibliography
    Shah, A. (2018). ASDOC: Stata module to create high-quality tables in MS Word from Stata output. Statistical Software Components S458466, Boston College Department of Economics.





    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


    • #3
      thank you very much Attaullah, that works great! i have been using asdoc for a few days now and its enormously helpful.

      will it be those commands everytime? (ie do I run the exact code below everytime i have a new lstat report). i will be exporting a few into my thesis.

      loc sensetivity : di %9.3f = `r(P_p1)' loc Specificity : di %9.3f = `r(P_n0)' loc pp : di %9.3f = `r(P_1p)' loc np : di %9.3f = `r(P_0n)' asdoc, row(Classified, Probability) replace title(My Table) asdoc, row(Sensitivity, `sensetivity') asdoc, row(Specificity, `Specificity') asdoc, row(Positive predictive value, `pp') asdoc, row(Negative predictive value, `np')

      Comment


      • #4
        Yes, the lines of codes are generic and can be used after any logistic regression.
        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


        • #5
          Originally posted by Attaullah Shah View Post
          Yes, the lines of codes are generic and can be used after any logistic regression.
          game changer! thank you so much
          BW

          Comment

          Working...
          X