Announcement

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

  • Exporting results in a file to win time

    I have results to register in a doc file or an excel file. It will be easier to have results after. How can I do that ?
    The resultas I have to register are :

    "strate maxexpo_ardbis, per(100000) smr(taux_colo)
    strate iechi_5cl, per(100000) smr(taux_colo)
    strate statut_tabac, per(100000) smr(taux_colo)"

    Thanks a lot

  • #2
    Here's an example:

    Code:
    clear
    webuse diet
    stset dox, origin(time doe) id(id) scale(365.25) fail(fail==1 3 13)
    stsplit ageband, at(40(10)70) after(time=dob) trim
    strate ageband, per(1000)
    merge m:1 ageband using https://www.stata-press.com/data/r16/smrchd
    strate ageband, per(1000) smr(rate) output(temp.dta, replace)
    use temp.dta, clear
    putexcel set temp.xlsx, replace
    mkmat ageband-_Upper, matrix(temp)
    matrix list temp
    putexcel A1 = matrix(temp), colnames
    putexcel save

    Comment


    • #3
      There are many procedures to write results to files. If you search Statalist you will find some. Personally, I use outreg2, but that is largely because I got started with it. The putexcel procedures work find but seem to be a bit harder to do than estout or outreg2 or asdoc.

      Comment


      • #4
        Using Dave Airey code here is how to export the matrix to Word with asdoc

        Code:
        * Install asdoc
        ssc install asdoc, replace
        
        webuse diet
        stset dox, origin(time doe) id(id) scale(365.25) fail(fail==1 3 13)
        stsplit ageband, at(40(10)70) after(time=dob) trim
        strate ageband, per(1000)
        merge m:1 ageband using https://www.stata-press.com/data/r16/smrchd
        strate ageband, per(1000) smr(rate) output(temp.dta, replace)
        use temp.dta, clear
        mkmat ageband-_Upper, matrix(temp)
        matrix list temp
        
        * Now use asdoc to export the matrix
         asdoc wmat, mat(temp) replace
        Click image for larger version

Name:	Capture.PNG
Views:	1
Size:	10.9 KB
ID:	1521843

        For those who are not yet familiar with asdoc, it can be downloaded from SSC and can be used with almost all Stata commands. Here is a short blog post that shows how asdoc can be used with any Stata command http://fintechprofessor.com/2018/02/...basic-example/. You can also watch several YouTube videos that show the use of asdoc https://www.youtube.com/watch?v=zdI6...LwodAk2oqLYhr-

        Code:
        * For installation of the stable version 
        ssc install asdoc
        
        * For installation of the new beta version
        net install asdoc, from(http://fintechprofessor.com) replace
        help asdoc
        Last edited by Attaullah Shah; 24 Oct 2019, 13:58.
        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
          Than kou very much for your answers : in fact when i do that :

          strate maxexpo_ardbis, per(100000) smr(taux_colo)
          output(temp.dta, replace)
          use temp.dta, clear
          putexcel set temp.xlsx, replace
          mkmat maxexpo_ardbis-_Upper, matrix(temp)
          matrix list temp
          putexcel A1 = matrix(temp), colnames
          putexcel save

          I have the error messages in red : unrecognized command: output / unrecognized command: putexcel

          What is the more simple launching for save results in excel or word ?

          Comment


          • #6
            I also want to have just 2 decimals in SMR and IC, with dd(2) it doesn't work...

            Comment

            Working...
            X