Announcement

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

  • outreg2 command hiding automatically generating dummies

    I am using

    xtreg x y varlist i.dummy1 i.dummy2 i.dummy3, fe

    I want to export my regressions in tables and keep all variables I want to experiment with except the dummies. However, precisely because I am experimenting all the time with the regressions by adding new variables it inconvenient to use the '
    Code:
    keep
    ' option in
    Code:
    outreg2
    when want to export results.

    So, I am trying to use the `
    Code:
    drop
    ` option as below, but does not work

    outreg2 using results_exp.xls, append addtext(Industry FE, Yes, Country-Sector FE, Yes, Country-Year FE, Yes) drop(i.dummy1 i.dummy2 i.dummy3) dec(3) title("Pooled OLS across All Sectors")

    However, the tables for some reasons still shows the some of the dummies.

    How one can remedy for this problem? Using the keep option works, but because I have long list of dependent variables and want to keep adding, is very cumbesome to use the
    Code:
    keep
    option in this case.

  • #2
    I am not sure how to solve this using outreg2. However, we can asdoc that supports full regression tables and nested regression tables. To install,
    Code:
    ssc intall asdoc
    See one example below.
    clear
    Code:
    sysuse auto
    asdoc reg price mpg rep78 headroom trunk i.foreign, add(Industry FE, Yes, Country-Sector FE, Yes, Country-Year FE, Yes) drop(i.foreign) dec(3) title(Pooled OLS across All Sectors) nest replace
    asdoc reg price mpg rep78 headroom trunk weight i.foreign, add(Industry FE, Yes, Country-Sector FE, Yes, Country-Year FE, Yes) drop(i.foreign) dec(3) title(Pooled OLS across All Sectors) nest append
    Click image for larger version

Name:	asdoc reg.png
Views:	1
Size:	36.9 KB
ID:	1452423


    For more on asdoc, please visit https://fintechprofessor.com/2018/02...basic-example/
    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
      Hi Attaullah, The results are often saved in the word file. Can it be shown on the screen (as esttab/estout)?
      Last edited by River Huang; 08 Jul 2018, 22:09.
      Ho-Chuan (River) Huang
      Stata 17.0, MP(4)

      Comment


      • #4
        Since asdoc causes Stata to run the given command and create its own tables on the fly, therefore it displays the native Stata output on screen and generates formatted tables in Word file. All these happen in one go without running commands two times.
        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
          Since asdoc causes Stata to run the given command and create its own tables on the fly, therefore it displays the native Stata output on screen and generates formatted tables in Word file. All these happen in one go without running commands two times.
          hi it's very useful for me to drop the dummy variables. another question is how to drop these omitted dummy variables in the sheet via outreg2.

          Thank you!

          Comment


          • #6
            Replying to #1 and #5, there is nothing wrong with the syntax of outreg2 (from SSC). This will drop the dummies

            Code:
            outreg2 using results_exp.xls, drop(i.dummy1 i.dummy2 i.dummy3) dec(3)
            However, there is an inconsistency in what is wanted in #1.

            outreg2 using results_exp.xls, append addtext(Industry FE, Yes, Country-Sector FE, Yes, Country-Year FE, Yes) drop(i.dummy1 i.dummy2 i.dummy3) dec(3)
            The -append- option suggests that you want to add a new set of results to some existing ones. If the existing results included the dummies, options specified in the new command will only affect the appended results and therefore will not delete those that already exist. You need to be consistent from the start, dropping the dummies at each stage if you do not need them.

            Comment

            Working...
            X