It’s worth noting, however, that both export excel and putexcel allow users to place multiple tables or other output in the same worksheet by modifying the sheet rather than replacing it, and specifying in which cell the commands should place output. In this tutorial, we’ll be placing each table in its own new worksheet in the top-left cell. The putexcel command requires Stata version 13 or later. Then, we’ll use putexcel to place the results into the spreadsheet. After using that command, we’ll use putexcel set to indicate which Excel workbook and sheet we’d like the results to be written to. In one case, the command does not replace data in memory, but instead stores the components of the table in a special place in Stata’s memory known as “returned results” (more on that later). After the data in memory has been replaced with the table, we’ll use the export excel command to export the dataset as a sheet in an Excel workbook. These commands do exactly what their names suggest. Because we want to keep working with our original dataset, we’ll sandwich most of our work between the commands preserve and restore. A tutorial on survey data analysis with Stata can be found here.īefore we dive in, we first need to introduce a few other commands we will use.įor the most part, the commands we’ll be using work by replacing the data in memory with the frequency table or table of summary statistics. With survey estimation commands, you can correctly calculate standard errors with which to gauge the reliability of your estimates and can conduct statistical tests to ensure that observed differences are statistically significant. If you are analyzing survey data, we highly recommend using Stata’s survey estimation commands rather than the commands covered in this tutorial. This tutorial is not intended for users working with survey data with a complex survey design, such as American Community Survey or Current Population Survey microdata. do file, the Excel spreadsheet will be automatically populated with our tables - no copy-pasting needed. This tutorial will demonstrate that when we use these commands, when we re-run our. Thankfully, Stata also has commands for summary statistics that do provide a way to subsequently write the content of those tables to Excel. This runs the risk of human error, like typos or pasting the wrong table to the wrong place in a spreadsheet, or neglecting to re-paste in a table that’s changed. do file, and replace each one by scrolling through the Results pane and copy-pasting again.
#Install putexcel stata 12 manual#
With a manual copy-paste approach, we’d need to keep track of which tables changed as we revise our. That may seem easy enough to do once, but keep in mind that in a real-world analysis, we’d likely want multiple tables of results in a spreadsheet, and may change what we’re calculating and how as we refine our analysis. For instance, the only way users can get a table produced by tabulate out of Stata is to copy-paste the table from the Results pane into a spreadsheet. Many of these commands, however, don’t facilitate afterwards getting the tables they display out of Stata and into an Excel spreadsheet in a reproducible way. If not currently possible, if you ask he may add your suggestion to a future asdoc update.Stata has many options for creating frequency tables and tables of summary statistics. He is very helpful and responsive so you might ask him. The author of asdoc is Professor Attaullah Shah. You can specify custom significance levels by using star(.05) rather than star(all) as I do above, but this will put one star by every correlation coefficient significant at a 5% level and I do not think you can specify more than 1 level at a time. I do not believe you can specify star numbers and significant levels the way you would like to using asdoc. asdoc pwcorr var1 var2 var3, star(all) replace
#Install putexcel stata 12 code#
Second, you should not have the second comma right after the star command.įor example, the code below will output a correlation matrix with 1 star if significant at a 10% level, 2 stars if significant at 5% level, and three stars if significant at a 1% First, you need to use pwcorr rather than corr to be able to add stars to your correlation matrix.