Getting Stata output into Excel, Power Point, MS-Word, Word PerfectSince many different software packages (e.g. Power Point) read in Excel spreadsheets this tutorial is focused on getting your Stata results into Excel spreadsheets. Once you have your results in an Excel spreadsheet you are ready to either use Excel to format the table or create the graph, or bring the results into some other software. There are ways to create graphs and to format your results in Stata, but most people are already familiar with doing all that with one of these 4 software packages. There are at least 5 ways to get your results out of Stata and into Excel using native Stata commands.(Additional commands, available free from the SSC archives, are listed below.)No matter which way you choose, it's always a good idea to check that the process did what you expected.From the Stata results window:
From a log file:
TIP: Make use of Stata's ability to start and stop logging to a log file so that your log file contains only one table of results. It's easier to have multiple log files with one table per file than multiple tables and other code in one big log file. use "t:\statatut\examfac2.dta"
From a Stata data set:First you need to learn how to save your results in a Stata data set. The parmest command is designed to do this. You may be able to use the collapse command if you want summary statistics such as the mean or percentiles. Once you have your results in a Stata data set you can try either of the following two methods. A benefit to having your results in a Stata data set is that you can use your Stata data management skills to manipulate them to your liking (e.g. drop certain columns from your results) before you bring them into Excel. Either of these two methods becomes more helpful when creating a lot of tables.
#1- Select text in Stata and paste into Excel.
#2- Select text in Stata log window and paste into Excel.
#3- Open a log file (*.log) into Excel as a fixed width file:
#4- Use DBMScopy to convert the Stata data set to an Excel spreadsheet:CPC has DBMScopy on unix as well as on the Windows network. Click here for instructions on how to use DBMScopy interactively.The basics of this method is to generate a Stata data set that contains the results you want to make into a table. DBMScopy can make an Excel copy of the data set. This Excel file can be read into Excel, Power Point, MS-WORD, Word Perfect. Back#5 - Use the outsheet command to output a spreadsheet that can be read into Excel.This method requires that you start with your results in a Stata data set.
/* Create tab delimited text file */
/* create comma separated values text file */
There are at least 3 ways to get your results out of Stata and into MS Word or Excel using user-contributed commands.These have been installed at CPC. If you need them for your laptop or home computer, you may download them using the ssc command. For example, ssc describe xml_tab will give you the details, and ssc install xml_tab will install the package.The discussion below is brief, intended only to point you to the command you might need. See the help for each command for details. taboutThe tabout command produces publication-quality cross tabulations. Lots of features are available to customize the table. The output file may be in tab-delimited or html format. Tab-delimited format files may be copied into Word and converted into a table using the Table menu (Table, Convert, Text to table). Html format files can be opened in your browser and copied. Inside Word, use Paste Special and paste the table as Formatted Text (rtf).estoutThe estout command produces regression tables from stored estimates. All modeling commands in Stata put the results (such as beta coefficients) into temporary variables. These can be stored for use by the estout command. The output file may be tab, fixed, Tex, or html. Tab-delimited format files may be imported into Excel using the Import Wizard. Html format files can be opened in your browser and copied. Inside Word, use Paste Special and paste the table as Formatted Text (rtf).xml_tabLike estout, the xml_tab command works from stored estimates. The output is in Excel's xml format. This format allows for a very feature-rich table that takes advantage of many of Excel's capabilities. To open the file in Excel simply click on File, Open. If xml_tab can locate Excel on your computer, it will create a link in the Stata Results window from which you can open the file.Review Again? Another topic? Questions or comments? If you are affiliated with the Carolina Population Center, send them to Phil Bardsley.
|

