How do you save stata output




















The advantage of translate is that unlike a log file that has to be opened before you run the commands, translate captures all of the output that has already been produced. One way to save all of the results from your Stata session, is to use a log file. As mentioned above, a log file will include all the output produced while the log file is open. To open a log file called c:dissert. The results of all of your commands will be saved in the log file for this example, c:dissert.

The translate command converts all of the output currently in your Results window into a text file. As mentioned above, this is useful if you have run a bunch of analyses and then realize you forgot to start a log file. In the example below, we run a regression analysis and a summarize command. We then use the translate command to output everything from the Results window to a text file, called mylog. Note that the maximum format widths for cformat , pformat , and sformat are 9, 5, and 8 in that order.

Therefore, you may encounter difficulties if you wish to display are larger number of decimals than the one set by default. But you should strive for simplicity anyway. To keep record of Stata's output, you have to specify a log file. In other words, by default the output is shown in the output window only.

Note that you have to open the log file before output can be written to it. In other words, you cannot save output to a log file a posteriori. Note, however, that there is some sort of workaround; see the following section.

Stata recommends to use the SMCL format, as it keeps some formatting that is helpful when looking at the file with the Stata viewer; it is therefore the default format. If you are sure you do not need this, the text format is better for accessing the log file with other software such as a word processor.

However, you can also "translate" an SMCL file into a text file. The file will be found in your working directory. But you may have changed to a different directory; in this case you will find the log file there. You probably may also indicate a path for the log file. To have further output written to a log file, you have to specify again a log file with "log using It is important to know whether this file already exists and how you wish to handle this.

The results may either printed or opened with a word processor. For the latter purpose, the output has to be translated if you have used the SMCL format:. First, you can always copy the output directly from the screen to some other file, e. Second, there is a nice feat which permits to save your results, as long as they are accessible in the results windows.

It goes like this:. Now, Stata will write everything that can be found in the scroll buffer equivalent to everything you can see on your screen, including those parts you have to scroll in order to see them in a txt-File with the name "name-of-some-file".



0コメント

  • 1000 / 1000