Outputting Stata Summary and Regression Tables for Excel, Word, or LaTeX

Sdílet
Vložit
  • čas přidán 11. 09. 2024
  • Don't you dare spend hours copying over every cell of your table by hand! There are many easier ways to get your results out of Stata. Goes over outreg2, mkcorr, and copying tables.
    For some reason the sound didn't kick in at the start and I had to cut out the part where I explain that you might need to download outreg2 using ssc install outreg2.

Komentáře • 127

  • @niilolaiho9991
    @niilolaiho9991 Před 6 lety +21

    From somebody making their Bachelor's thesis: this is brilliant, much appreciated!

  • @boyzrulethawld1
    @boyzrulethawld1 Před 4 lety +2

    The copy table function at the end made me LOL at how easy it was.
    Hey, cheers for a great tutorial. Take it easy Mr. Nick.

  • @jordiburger1462
    @jordiburger1462 Před 3 lety +7

    for anyone who wants to use it with latex: you just need to write tex instead of excel. In my packege version it doesn function if you type in "latex" (as shown in video)

  • @awhileawonder
    @awhileawonder Před 6 lety +7

    " Don't you dare spend hours copying over every cell of your table by hand! " Hah thank you Nick, that was me a couple of hours ago until persistence wore thin and sensibility caught up to me, yelling, "THERE MUST BE A BETTER WAY TO DO THIS."

    • @godoggo9346
      @godoggo9346 Před 4 lety +1

      THERE MUS TBE A BETTER WAY TO DO THIS is a summary of my entire research process

  • @basti0159
    @basti0159 Před 3 lety

    thanks its so helpful and you cannot find this information anywhere but here!

  • @Garrettthethief
    @Garrettthethief Před 6 lety +2

    Thank you Nick. You are a valuable person.

  • @aaronstark1969
    @aaronstark1969 Před 3 lety +1

    Why would my results say “command outreg2 is unrecognized”

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  Před 3 lety +3

      Because outreg2 is a user written command that must be installed. Do ssc install outreg2

    • @aaronstark1969
      @aaronstark1969 Před 3 lety +1

      @@NickHuntingtonKlein Thank you so much, just downloaded Stata and I couldn’t get that to work, you’re a huge help

  • @bentomunkuka2256
    @bentomunkuka2256 Před rokem

    Can someone help? I am getting this reply "matrix e(b) not found; run/post a regression, or specify varlist for non-regression outputs"

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  Před rokem

      That message is suggesting that you didn't run a regression first. If you haven't run anything there's nothing for outreg2 to output

  • @HuzMusFinanceData
    @HuzMusFinanceData Před 3 lety

    Thank you for such a useful Video... Stay healthy..

  • @hannahrichards4200
    @hannahrichards4200 Před 7 lety +6

    This video was extremely useful - thank you so much! I'm turning in my first-year summer paper in a few days, so I was looking for a quick way to export my summary statistics, correlations, & regression results, & this video tackled all those questions!
    I especially enjoyed learning about the mkcorr function since it exports summary statistics and correlations at the same time. However, do you know if there is a way to get the significance levels marked on the correlations? The following command is what I was using to export correlations & that Excel output does show the significance levels:
    estpost corr (variables), matrix listwise
    est store c1
    esttab * using correlations.csv, unstack not noobs compress

  • @lphoca8861
    @lphoca8861 Před 6 lety +1

    life saving video. A big thank you!

  • @bwemlie
    @bwemlie Před 5 lety +1

    Thanks man! Really appreciate it:) WE WANT MORE!!

    • @bwemlie
      @bwemlie Před 3 lety

      For the record, I am now working on my third thesis and I just watched your video again to see that I apparently commented on it hahah

  • @oluwakemioyewande4047
    @oluwakemioyewande4047 Před 2 lety

    by region_code, sort : regress Log_GDP_Per_Capita lpc lhc
    How do I export the result for each region at once to excel using outreg2. I did this but only one region result was exported. note that all regions' output will be shown at once in Stata

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  Před 2 lety

      Oh I see. You'll need to use a loop instead of a bysort. See www.statalist.org/forums/forum/general-stata-discussion/general/1567800-how-to-use-outreg2-when-running-regression-bysort

  • @MohamedElheddad
    @MohamedElheddad Před rokem

    Hi, I am struggling with exporting the STATA output to LYX/ Overleaf (Latex). It is mentioned in the title " Outputting STATA regression for Latex" but I could not find it in the video. Do you have a video about this? If so, I would be great.

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  Před rokem

      As it mentions about 1:48, if you put latex instead of excel in the options, it will output a file with LaTeX table code in it.

  • @maxvanheerde5582
    @maxvanheerde5582 Před 3 lety

    When I use this command it all works in stata but when I go to the folder I only find an XML and textdocument but no actual excel file. How do I get the actual excel file? Thanks in advance!

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  Před 3 lety

      The xml file should be able to open in Excel

    • @maxvanheerde5582
      @maxvanheerde5582 Před 3 lety

      @@NickHuntingtonKlein it's really weird but it opens internet explorer automatically (which I don't use) when I click on the XML file and it's not the data output from stata but more like some random text... Also when I try to open the XML file through an empty excel file nothing happens

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  Před 3 lety

      @@maxvanheerde5582 It sounds like XML files are not associated with Excel in your system. But it should work if you right click the file and do "Open With" and select Excel.
      If that still doesn't work you might want to try another table-export package like regsave.

  • @polywaggot9830
    @polywaggot9830 Před 3 lety

    Hi i'm trying to do this with a dummy in my regression and it's saving all my variables as Firm.1, all the way up to Firm.850, it would be impossible for me to manually edit this, I was trying to use the label command but no success, do you know how I make it show the firm names rather than the stata names?

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  Před 3 lety

      It would work if your firm variable is properly labeled. Take your string variable with the firm names and use encode on it. That should hopefully work

  • @danielgardner4267
    @danielgardner4267 Před 6 lety

    Thank you Nick, you are the best.

  • @Hendrichards
    @Hendrichards Před 6 lety +1

    Hi Nick, the command outreg2 doesn't work for me. I am on Stata15 and it says command outreg2 is urecognised.

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  Před 6 lety +2

      Whenever Stata tells you a command is unrecognized that means you haven't installed the package for it. You can usually do this with the ssc install command. So put "ssc install outreg2" in Stata and run that, and from that point on, your copy of Stata will always be able to use outreg2.

    • @parfaitberi3974
      @parfaitberi3974 Před 5 lety

      @@hossamabdellatif3039 I had a similar problem even after installing "ssc install outreg2". But then, I found somewhere that I could install "ssc install mkcorr", and it worked pretty well for me!
      Thanks

  • @rasheedatoluwakemi6906
    @rasheedatoluwakemi6906 Před 2 lety +1

    Thanks Nick for the video, I tried using outreach with a multiple regression in different country regions. It displays only the last region result in the excel file. How can I rectify this to reflect all regions in the regression result?

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  Před 2 lety

      If you're running multiple regressions you need to run outreg2 after each regression, using the append option to keep adding to the same file

  • @luisortizgervasi3820
    @luisortizgervasi3820 Před 4 lety

    Great....¡ Clear and straightforward. Many thanks

  • @frankmaina7070
    @frankmaina7070 Před 4 lety +1

    Hey... Thanks for the informative video
    However, my stata is telling me that it doesn't recognize the command outreg2...what do I do?

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  Před 4 lety +3

      outreg2 needs to be installed. You can do this with
      ssc install outreg2

    • @frankmaina7070
      @frankmaina7070 Před 4 lety +2

      @@NickHuntingtonKlein that was fast 🙌👊...thank you very much...the command has worked now

  • @ahmedelrabbat6892
    @ahmedelrabbat6892 Před 5 lety +1

    dear
    thanks so much, i actually used the command and worked but when i try to open it , tell me the Xml file regression results .xml cannot be opened because there is no available data view(xslt)

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  Před 5 lety

      Excel should be able to read the file. You might have xml files associated with a different program. Try opening excel first and using File -> Open to open the Xml file, see if that works.

    • @georgi8254
      @georgi8254 Před 5 lety

      Hi, @@NickHuntingtonKlein, this is super useful! Thank you. However, I am having the same issue as ahmed, and the same message pops up for some reason.

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  Před 5 lety

      Try designating the file as an .xls in the outreg2 command and see if that works @@georgi8254

  • @halomaster657
    @halomaster657 Před 4 lety

    Hi im trying to donwload outreg2 into STATA but get the following error message if anyone can help please. "could not rename c:\ado\plus\stata.trk to c:\ado\plus\backup.trk"
    may be important to note that I am using a remote desktop.

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  Před 4 lety

      That's strange! Sounds like a permission issue on your computer or something? I'm not really sure how to fix it

  • @elishayu8002
    @elishayu8002 Před 4 lety

    Hello, is it possible to export to different sheets in ONE Excel file using outreg2? Thank you!

  • @HarryWalshe
    @HarryWalshe Před 5 lety

    Hello, after running my regression analysis, my output doesn't come out as clear as in the video here. How do I rectify my problem?

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  Před 5 lety

      Depends on the issue. Some regression commands don't play well with outreg2, so if you're doing something unusual that could be it.

    • @HarryWalshe
      @HarryWalshe Před 5 lety

      Is there a way I could send you a screenshot of my problem so you could have a closer look?

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  Před 5 lety

      @@HarryWalshe sure. My email is on my website nickchk.com

  • @maenesophie31
    @maenesophie31 Před 4 lety

    I have a problem when I do the "outreg2 using regression_results2, replace excel dec(3)" command I get an error saying that the XML-file can not be opened as there is no available data displayer: details: specified error
    location: row:1 column 361. Do you have a solution for this?

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  Před 4 lety +1

      Strange, I've never seen that error before. Maybe try specifying the .xls extension? Like "outreg2 using regression_results2.xls, replace excel dec(3)"

    • @krystalpalmer2595
      @krystalpalmer2595 Před 4 lety

      @@NickHuntingtonKlein I was having the same problem. This solution worked for me. Thanks!

    • @ViralVidz21
      @ViralVidz21 Před 2 lety

      @@NickHuntingtonKlein Solution worked well done

    • @ViralVidz21
      @ViralVidz21 Před 2 lety

      @@NickHuntingtonKlein Solution worked well done

  • @harutohonda7564
    @harutohonda7564 Před 3 lety

    such a nice video
    helped me a lot
    thanks!!!!

  • @jiangally4919
    @jiangally4919 Před 4 lety

    Thank you so much! This is so helpful!!!

  • @MrLodesmond
    @MrLodesmond Před 4 lety

    How can I deal with interaction effect between two variables? Thanks.

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  Před 4 lety

      See my video on interaction terms in stata czcams.com/video/9dNZJziERHw/video.html

  • @yusnipuspasari5306
    @yusnipuspasari5306 Před 2 lety

    thank you so much, it help me a lot

  • @lorenzopignataro591
    @lorenzopignataro591 Před 4 lety

    what if I get r(603) file xxx.txt could not be opened?

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  Před 4 lety

      It's having trouble opening the file. The file might not be formatted correctly for what you're doing

  • @criticalcog6363
    @criticalcog6363 Před 5 lety

    This was very helpful, thank you. Is there a way to use adjusted R^2 in the output regression tables with outreg2, or do you just have to do it manually?

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  Před 5 lety +1

      If you look in the help file for outreg2 you can see that it allows you to include a whole bunch of extra statistics. If one isn't supported you can extract it yourself and include it in outreg with the addtext() option

  • @DevianParraP
    @DevianParraP Před 6 lety

    Thank you Nick. Despite the progress I got with this video, I still have an issue with my model. I am running a logistic regression model reporting ODDS ratios, but the output table only shows raw coefficients despite I use the logistic command in Stata. Can you help me?

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  Před 6 lety

      Devian Parra Padilla Hi Devian. Good question! I'd recommend taking a look at this Statalist post: www.statalist.org/forums/forum/general-stata-discussion/general/844502-outputting-logistic-regression-results-using-outreg2-command

    • @DevianParraP
      @DevianParraP Před 6 lety

      Nick Huntington-Klein Thank you Nick for your willingness to help. The post looks very useful

  • @regularviewer1682
    @regularviewer1682 Před 5 lety

    After the regression... How did you get the number of observations in your excel table when they weren't there in the notes?

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  Před 5 lety +1

      Outreg2 will include the number of observations automatically. You can also see the number of observations in the Stata table in the top right (Number of obs.)

    • @regularviewer1682
      @regularviewer1682 Před 5 lety

      @@NickHuntingtonKlein Thanks!

  • @katiesullivan8055
    @katiesullivan8055 Před 4 lety

    This is so useful! Thank you!

  • @kirkmotocross9388
    @kirkmotocross9388 Před 4 měsíci

    may be to old of a video but outreg2 is not working. says it is unreconizable

    • @kirkmotocross9388
      @kirkmotocross9388 Před 4 měsíci

      well I got it to work from other comments but now it is opening into word

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  Před 4 měsíci

      @@kirkmotocross9388 Set the output document type in "using" i.e. output.tex or look at the help file for how to set the output type using options.

  • @takrimas
    @takrimas Před 3 lety

    It's a life-saving one! However, I couldn't use the mkcorr command. Please kindly suggest how to use it.

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  Před 3 lety

      Install it first with ssc install mkcorr

    • @takrimas
      @takrimas Před 3 lety

      @@NickHuntingtonKlein thank you so much for your prompt reply.

  • @bochengjing883
    @bochengjing883 Před 5 lety

    I don't think this works for the streg. Also, where is the regression_results variable or table? Is it pre-created?

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  Před 5 lety

      There are some commands that outreg2 doesn't work with. I've never used streg so I'm not sure if it's one of them. You might try estout instead of outreg2 in that case. regression_results is the name I chose to give the file that outreg2 made.

    • @bochengjing883
      @bochengjing883 Před 5 lety

      @@NickHuntingtonKlein I see. I have been researching on how to output Hazard ratio and p-value to excel sheet for STREG for a while and couldn't find a good solution. Not sure Stata could handle it.

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  Před 5 lety

      @@bochengjing883 If none of the export commands work, you can always select the table in Stata, right click, choose "Copy Table" (not just Copy but Copy Table) and paste into Excel.

    • @bochengjing883
      @bochengjing883 Před 5 lety

      @@NickHuntingtonKlein I know but what I want is the detailed p-value. I am using 1 million records to run the streg, which p-value is extremely significant (p=10^(-100)), I want to output all the detailed p-value so I can make a decision. Copy and Paste couldn't do it as the p-value is only 0.000.

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  Před 5 lety

      @@bochengjing883 Ah, I see. For something unusual like that you'll probably have to code the output by hand. Look at the streg documentation to see where values like the p-value are stored (or the component parts that let you estimate it yourself). Basically, pull out the regression info you want into locals and write a loop to generate a CSV file. See this thread for an example twitter.com/nickchk/status/1146859527456940034

  • @AnaPerez-bd1sq
    @AnaPerez-bd1sq Před 4 lety

    you're amazing and I love you :,)

  • @huynhngoctrong9510
    @huynhngoctrong9510 Před 6 lety

    That was awesome Nick!

  • @lucialara3875
    @lucialara3875 Před 2 lety

    Thank youuuuuu!

  • @suriyaparvinnishi3710
    @suriyaparvinnishi3710 Před 6 lety +1

    The same process is applicable for exporting in Latex?

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  Před 6 lety +2

      Yes, correct. Just put latex instead of excel in the command options, and it will output LaTeX code you can copy wherever you need it.

    • @nouhailasafi6685
      @nouhailasafi6685 Před 3 lety

      @@NickHuntingtonKlein it didn't work for me. They say option latex not allowed

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  Před 3 lety +1

      @@nouhailasafi6685 sorry I should have said tex instead of latex. See help outreg2 for the full syntax

    • @nouhailasafi6685
      @nouhailasafi6685 Před 3 lety

      @@NickHuntingtonKlein I used it right now. It still didn't work for me. They say that file could not be opened

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  Před 3 lety +1

      @@nouhailasafi6685 either the file you're trying to save to is open in another program, or the syntax is wrong. What is the line of core you're using?

  • @SebiScoot
    @SebiScoot Před 2 lety

    thanks a lot works well with esttab aswell

  • @inaevalerio5464
    @inaevalerio5464 Před 3 lety +1

    Nick, thank you so much for this excellent video. It helps me a lot! I was wondering if there is a way to export my confidence interval too... Thanks again in advance!

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  Před 3 lety

      Use the stats(ci) option of outreg2. And thanks!

    • @yannisima3043
      @yannisima3043 Před 2 lety

      @@NickHuntingtonKlein can you please write the command? thanks

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  Před 2 lety

      @@yannisima3043 To add an option to a command in Stata, just do a comma and then the option. So here it's:
      outreg2 using "filename", stats(ci)

  • @Mineirovsky
    @Mineirovsky Před 5 lety

    Very helpful. Thanks.

  • @Spacemrk
    @Spacemrk Před 6 lety

    Sorry but this isn't working for me at all as Excel cannot open the file

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  Před 6 lety

      Spacemrk It should be able to. You might want to try opening Excel first and opening it from there.

  • @praveenkumar-kn7qf
    @praveenkumar-kn7qf Před 3 lety

    This is GREATTTTT

  • @hussainimussa
    @hussainimussa Před 3 lety

    Thanks Nick! Can you please make a similar video for R? I was wondering what options are available in R. thanks again :)

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  Před 3 lety +1

      There are quite a few options, but I recommend modelsummary for regression tables, and the sumtable function in my own vtable package for summary statistics

  • @AllanKOSTO
    @AllanKOSTO Před 4 lety +1

    Awesome video Nick!!!
    Actually, how can I import a tabulate or a summarize from stata to latex text, can you give me a stata command?
    THX my friend

  • @noorrizvi1657
    @noorrizvi1657 Před 6 lety

    Thank you very much!

  • @DIMPLEKHATTAR
    @DIMPLEKHATTAR Před 5 lety

    hey, how to do the same in Stata 12

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  Před 5 lety +1

      All of this works the same in stata 12. Just be sure to install outreg2 first using "ssc install outreg2"

    • @DIMPLEKHATTAR
      @DIMPLEKHATTAR Před 5 lety +1

      @@NickHuntingtonKlein, thanks!

  • @camilafloressanhueza7966

    Thank u Thank u Thank u!!!!!!!!!

  • @tesfahun_taddege
    @tesfahun_taddege Před 6 lety

    Very Helpful

  • @jeetv
    @jeetv Před 5 lety

    Excellent!!

  • @beingfijian1855
    @beingfijian1855 Před 3 lety

    why do you use outreg2. it doesnt work for me. you need to explain each stuff.

  • @alessandragutierrezgamboa5069

    CAN YOU DO A VIDEO ON ODDS RATIO?

  • @jiayanglu4161
    @jiayanglu4161 Před 4 lety

    Thank you!

  • @dougrhess
    @dougrhess Před 6 lety

    Well done.

  • @dhanishtha_anand
    @dhanishtha_anand Před 5 lety

    Thank you so muchhhhh

  • @zerohero109
    @zerohero109 Před 5 lety

    Bookmarked.

  • @rajchatrg
    @rajchatrg Před 3 lety

    7:29