Announcement

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

  • Help making custom command like outreg2

    Hello, I'm writing to you to see if you can help me out with the ado I'm programming.

    I want to export tables with regression outputs to Excel, reporting my coefficients and the significance, pretty much like outreg2 does. I'm not using outreg2 because it doesn't let you save your results to a sheet or cell, and erases the format.

    To do this, currently I'm saving the coefficients and p-values in a matrix with eret display, within a loop for all my models. Then, this matrix is the input to my command, I pass my matrix to the database, convert the variables (coefficients) to strings and add the stars to the coefficients, to finally export my results with putexcel.

    The command works, but generating the matrix with eret display is a bit tedious, so I'm trying to do it in a similar way to outreg2: I want to store my reggresion's results with estimates store, then call my command in a way like this:

    reg ...
    est stores m1
    reg ...
    est stores m2
    mycommand [m1 m2], options

    So finally, my question is: How can I access and manipulate the estimations that are stored with my ado? I tried to read the outreg2 and estout codes but they are very complicated, and the documents about estimates and _estimates where not very helpful.

    Thanks in advance for your answers.

    Greetings,
    Nicolás.

  • #2
    You need to ask a more specific question, e.g.
    Why does estout do XXX?
    Is there an efficient way to accomplish YYY, rather than example ZZZ?

    Provide code and a question about that code, please.
    Doug Hemken
    SSCC, Univ. of Wisc.-Madison

    Comment


    • #3
      To add to Doug's comment, you'll increase your chances of a useful answer by following the FAQ on asking questions - provide Stata code in code delimiters, readable Stata output, and sample data using dataex.

      There are a great many routines for writing tables including putexcel, estout, outreg, outreg2, xml_tab, etc. Alternatively, if you want to store and manipulate results (rather than just make tables), then there are other approaches like estwrite. If you look for Clyde's comments in the last month or so on this listserve, you'll find he mentions programs that write results to a file.

      Comment


      • #4
        Sorry about the formating of my question: To be more concise, I want to know how can I access the results stored by the estimates store command. I want to know how to access and manipulate these estimates, ideally accessing the results as matrices. Ideally, I want to copy some of the syntax of outreg2, so an example of how I should call it is:

        Code:
         reg ...
        est stores m1
        reg ...
        est stores m2
        mycommand [m1 m2], options
        Thanks.

        Comment


        • #5
          You can use `est restore` to replay estimates. However, this does not restore `r(table)`. If you do

          Code:
          est restore m1
          _coef_table
          Then you would have access to everything left at the end of, for example, `regress`.
          Doug Hemken
          SSCC, Univ. of Wisc.-Madison

          Comment


          • #6
            Thanks Doug, that was exactly what I needed, now I can program my ADO.

            Comment

            Working...
            X