" 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."
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)
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
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?
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.
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)
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.
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.
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!
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
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?
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
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.
@@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
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 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
@@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.
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?
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
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?
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
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?
Strange, I've never seen that error before. Maybe try specifying the .xls extension? Like "outreg2 using regression_results2.xls, replace excel dec(3)"
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
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
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.
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.)
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.
@@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.
@@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.
@@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.
@@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
From somebody making their Bachelor's thesis: this is brilliant, much appreciated!
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.
" 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."
THERE MUS TBE A BETTER WAY TO DO THIS is a summary of my entire research process
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)
thanks its so helpful and you cannot find this information anywhere but here!
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
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?
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
Thank you Nick. You are a valuable person.
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.
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.
Hey... Thanks for the informative video
However, my stata is telling me that it doesn't recognize the command outreg2...what do I do?
outreg2 needs to be installed. You can do this with
ssc install outreg2
@@NickHuntingtonKlein that was fast 🙌👊...thank you very much...the command has worked now
Thank you for such a useful Video... Stay healthy..
Thanks man! Really appreciate it:) WE WANT MORE!!
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
It's a life-saving one! However, I couldn't use the mkcorr command. Please kindly suggest how to use it.
Install it first with ssc install mkcorr
@@NickHuntingtonKlein thank you so much for your prompt reply.
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)
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.
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.
Try designating the file as an .xls in the outreg2 command and see if that works @@georgi8254
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!
Use the stats(ci) option of outreg2. And thanks!
@@NickHuntingtonKlein can you please write the command? thanks
@@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)
Thanks Nick! Can you please make a similar video for R? I was wondering what options are available in R. thanks again :)
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
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?
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
Can someone help? I am getting this reply "matrix e(b) not found; run/post a regression, or specify varlist for non-regression outputs"
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
Hi Nick, the command outreg2 doesn't work for me. I am on Stata15 and it says command outreg2 is urecognised.
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.
@@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
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!
The xml file should be able to open in Excel
@@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
@@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.
life saving video. A big thank you!
Thank you Nick, you are the best.
Hello, is it possible to export to different sheets in ONE Excel file using outreg2? Thank you!
This isn't possible as far as I know. Maybe estout can do it?
Why would my results say “command outreg2 is unrecognized”
Because outreg2 is a user written command that must be installed. Do ssc install outreg2
@@NickHuntingtonKlein Thank you so much, just downloaded Stata and I couldn’t get that to work, you’re a huge help
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?
Depends on the issue. Some regression commands don't play well with outreg2, so if you're doing something unusual that could be it.
Is there a way I could send you a screenshot of my problem so you could have a closer look?
@@HarryWalshe sure. My email is on my website nickchk.com
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?
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
Nick Huntington-Klein Thank you Nick for your willingness to help. The post looks very useful
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?
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
That was awesome Nick!
such a nice video
helped me a lot
thanks!!!!
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?
Strange, I've never seen that error before. Maybe try specifying the .xls extension? Like "outreg2 using regression_results2.xls, replace excel dec(3)"
@@NickHuntingtonKlein I was having the same problem. This solution worked for me. Thanks!
@@NickHuntingtonKlein Solution worked well done
@@NickHuntingtonKlein Solution worked well done
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
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
Great....¡ Clear and straightforward. Many thanks
thank you so much, it help me a lot
Thank you so much! This is so helpful!!!
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.
That's strange! Sounds like a permission issue on your computer or something? I'm not really sure how to fix it
How can I deal with interaction effect between two variables? Thanks.
See my video on interaction terms in stata th-cam.com/video/9dNZJziERHw/w-d-xo.html
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
Use outreg2 with the sum(log) option as well as the tex option
This is so useful! Thank you!
After the regression... How did you get the number of observations in your excel table when they weren't there in the notes?
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.)
@@NickHuntingtonKlein Thanks!
you're amazing and I love you :,)
what if I get r(603) file xxx.txt could not be opened?
It's having trouble opening the file. The file might not be formatted correctly for what you're doing
The same process is applicable for exporting in Latex?
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.
@@NickHuntingtonKlein it didn't work for me. They say option latex not allowed
@@nouhailasafi6685 sorry I should have said tex instead of latex. See help outreg2 for the full syntax
@@NickHuntingtonKlein I used it right now. It still didn't work for me. They say that file could not be opened
@@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?
This is GREATTTTT
may be to old of a video but outreg2 is not working. says it is unreconizable
well I got it to work from other comments but now it is opening into word
@@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.
I don't think this works for the streg. Also, where is the regression_results variable or table? Is it pre-created?
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.
@@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.
@@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.
@@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.
@@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
CAN YOU DO A VIDEO ON ODDS RATIO?
Not something I'm currently planning, sorry
Nick Huntington-Klein still a good video thanksss :)))
hey, how to do the same in Stata 12
All of this works the same in stata 12. Just be sure to install outreg2 first using "ssc install outreg2"
@@NickHuntingtonKlein, thanks!
Sorry but this isn't working for me at all as Excel cannot open the file
Spacemrk It should be able to. You might want to try opening Excel first and opening it from there.
thanks a lot works well with esttab aswell
Very helpful. Thanks.
Thank youuuuuu!
Excellent!!
Well done.
Very Helpful
Thank you very much!
Thank u Thank u Thank u!!!!!!!!!
why do you use outreg2. it doesnt work for me. you need to explain each stuff.
It needs to be installed first with ssc install outreg2
Thank you so muchhhhh
Bookmarked.
7:29