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

Поделиться
HTML-код
  • Опубликовано: 21 авг 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.

Комментарии • 127

  • @niilolaiho9991
    @niilolaiho9991 6 лет назад +21

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

  • @boyzrulethawld1
    @boyzrulethawld1 4 года назад +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.

  • @awhileawonder
    @awhileawonder 6 лет назад +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 4 года назад +1

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

  • @jordiburger1462
    @jordiburger1462 3 года назад +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)

  • @basti0159
    @basti0159 3 года назад

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

  • @Garrettthethief
    @Garrettthethief 6 лет назад +2

    Thank you Nick. You are a valuable person.

  • @hannahrichards4200
    @hannahrichards4200 7 лет назад +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

  • @HuzMusFinanceData
    @HuzMusFinanceData 3 года назад

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

  • @bwemlie
    @bwemlie 5 лет назад +1

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

    • @bwemlie
      @bwemlie 3 года назад

      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

  • @lphoca8861
    @lphoca8861 6 лет назад +1

    life saving video. A big thank you!

  • @danielgardner4267
    @danielgardner4267 6 лет назад

    Thank you Nick, you are the best.

  • @luisortizgervasi3820
    @luisortizgervasi3820 4 года назад

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

  • @harutohonda7564
    @harutohonda7564 3 года назад

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

  • @jiangally4919
    @jiangally4919 4 года назад

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

  • @rasheedatoluwakemi6906
    @rasheedatoluwakemi6906 2 года назад +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  2 года назад

      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

  • @aaronstark1969
    @aaronstark1969 3 года назад +1

    Why would my results say “command outreg2 is unrecognized”

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  3 года назад +3

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

    • @aaronstark1969
      @aaronstark1969 3 года назад +1

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

  • @katiesullivan8055
    @katiesullivan8055 3 года назад

    This is so useful! Thank you!

  • @huynhngoctrong9510
    @huynhngoctrong9510 6 лет назад

    That was awesome Nick!

  • @yusnipuspasari5306
    @yusnipuspasari5306 2 года назад

    thank you so much, it help me a lot

  • @frankmaina7070
    @frankmaina7070 4 года назад +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  4 года назад +3

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

    • @frankmaina7070
      @frankmaina7070 4 года назад +2

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

  • @inaevalerio5464
    @inaevalerio5464 3 года назад +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  3 года назад

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

    • @yannisima3043
      @yannisima3043 2 года назад

      @@NickHuntingtonKlein can you please write the command? thanks

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  2 года назад

      @@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)

  • @ahmedelrabbat6892
    @ahmedelrabbat6892 5 лет назад +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  5 лет назад

      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 5 лет назад

      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  5 лет назад

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

  • @AnaPerez-bd1sq
    @AnaPerez-bd1sq 4 года назад

    you're amazing and I love you :,)

  • @FagnerDeschain
    @FagnerDeschain 5 лет назад

    Very helpful. Thanks.

  • @Hendrichards
    @Hendrichards 6 лет назад +1

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

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  6 лет назад +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 5 лет назад

      @@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

  • @criticalcog6363
    @criticalcog6363 5 лет назад

    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  5 лет назад +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

  • @SebiScoot
    @SebiScoot 2 года назад

    thanks a lot works well with esttab aswell

  • @MohamedElheddad
    @MohamedElheddad Год назад

    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  Год назад

      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.

  • @bentomunkuka2256
    @bentomunkuka2256 Год назад

    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  Год назад

      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

  • @oluwakemioyewande4047
    @oluwakemioyewande4047 2 года назад

    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  2 года назад

      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

  • @maxvanheerde5582
    @maxvanheerde5582 3 года назад

    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  3 года назад

      The xml file should be able to open in Excel

    • @maxvanheerde5582
      @maxvanheerde5582 3 года назад

      @@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  3 года назад

      @@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.

  • @hussainimussa
    @hussainimussa 3 года назад

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

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  3 года назад +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

  • @polywaggot9830
    @polywaggot9830 3 года назад

    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  3 года назад

      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

  • @takrimas
    @takrimas 3 года назад

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

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  3 года назад

      Install it first with ssc install mkcorr

    • @takrimas
      @takrimas 3 года назад

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

  • @DevianParraP
    @DevianParraP 6 лет назад

    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  6 лет назад

      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 6 лет назад

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

  • @tesfahun_taddege
    @tesfahun_taddege 6 лет назад

    Very Helpful

  • @lucialara3875
    @lucialara3875 2 года назад

    Thank youuuuuu!

  • @noorrizvi1657
    @noorrizvi1657 6 лет назад

    Thank you very much!

  • @camilafloressanhueza7966
    @camilafloressanhueza7966 5 лет назад

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

  • @dougrhess
    @dougrhess 6 лет назад

    Well done.

  • @HarryWalshe
    @HarryWalshe 5 лет назад

    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  5 лет назад

      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 5 лет назад

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

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  5 лет назад

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

  • @AllanKOSTO
    @AllanKOSTO 4 года назад +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

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  4 года назад

      Use outreg2 with the sum(log) option as well as the tex option

  • @jeetv
    @jeetv 5 лет назад

    Excellent!!

  • @praveenkumar-kn7qf
    @praveenkumar-kn7qf 3 года назад

    This is GREATTTTT

  • @jiayanglu4161
    @jiayanglu4161 4 года назад

    Thank you!

  • @regularviewer1682
    @regularviewer1682 5 лет назад

    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  5 лет назад +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 5 лет назад

      @@NickHuntingtonKlein Thanks!

  • @maenesophie31
    @maenesophie31 4 года назад

    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  4 года назад +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 4 года назад

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

    • @ViralVidz21
      @ViralVidz21 2 года назад

      @@NickHuntingtonKlein Solution worked well done

    • @ViralVidz21
      @ViralVidz21 2 года назад

      @@NickHuntingtonKlein Solution worked well done

  • @elishayu8002
    @elishayu8002 4 года назад

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

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  4 года назад

      This isn't possible as far as I know. Maybe estout can do it?

  • @kirkmotocross9388
    @kirkmotocross9388 4 месяца назад

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

    • @kirkmotocross9388
      @kirkmotocross9388 4 месяца назад

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

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  4 месяца назад

      @@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.

  • @MrLodesmond
    @MrLodesmond 4 года назад

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

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  4 года назад

      See my video on interaction terms in stata ruclips.net/video/9dNZJziERHw/видео.html

  • @halomaster657
    @halomaster657 3 года назад

    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  3 года назад

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

  • @suriyaparvinnishi3710
    @suriyaparvinnishi3710 6 лет назад +1

    The same process is applicable for exporting in Latex?

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  6 лет назад +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 3 года назад

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

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  3 года назад +1

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

    • @nouhailasafi6685
      @nouhailasafi6685 3 года назад

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

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  3 года назад +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?

  • @dhanishtha_anand
    @dhanishtha_anand 5 лет назад

    Thank you so muchhhhh

  • @bochengjing883
    @bochengjing883 5 лет назад

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

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  5 лет назад

      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 5 лет назад

      @@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  5 лет назад

      @@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 5 лет назад

      @@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  5 лет назад

      @@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

  • @lorenzopignataro591
    @lorenzopignataro591 4 года назад

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

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  4 года назад

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

  • @alessandragutierrezgamboa5069
    @alessandragutierrezgamboa5069 4 года назад

    CAN YOU DO A VIDEO ON ODDS RATIO?

  • @Spacemrk
    @Spacemrk 6 лет назад

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

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  6 лет назад

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

  • @DIMPLEKHATTAR
    @DIMPLEKHATTAR 5 лет назад

    hey, how to do the same in Stata 12

    • @NickHuntingtonKlein
      @NickHuntingtonKlein  5 лет назад +1

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

    • @DIMPLEKHATTAR
      @DIMPLEKHATTAR 5 лет назад +1

      @@NickHuntingtonKlein, thanks!

  • @zerohero109
    @zerohero109 5 лет назад

    Bookmarked.

  • @beingfijian1855
    @beingfijian1855 3 года назад

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

  • @rajchatrg
    @rajchatrg 3 года назад

    7:29