Printing log files in Stata

In this post, I will show you how to print log files in Stata. A log file is a record of your Results window. It records everything you type, and all textual output in response. All Stata output is processed by the Stata Markup and Control Language (SMCL). This includes log files, which are saved by default as SMCL files.

To print a standard SMCL log file, you need to have the log file open in a Viewer window. Log files are best viewed using Stata's Viewer. I have previously saved my SMCL log file 200529 - Mylog.smcl under C:/Users/KuaiKuaiWang/Documents/Stata.

There are two ways to open a Viewer window:

  • Click on the Log button, and select the file you want to open

  • Select File > Log > View, If there is a log file open, it will be the default log file to view; otherwise, you will need to either type the name of the log file into the dialog or click on the Browse... button to find the file with a standard files dialog:

Then the text in your log file will be opened in the Viewer window:

You can copy and paste the text between the Viewer and anything else that uses text, such as word processors and text editors. You can even paste into the Command window or the Do-file Editor.

Once the log file is in the Viewer, you can click on the Print button, or select File > Print.

  • You can fill in none, any, or all the items Header, User, and Project. You can check or uncheck options to Print header and footer, Print line numbers, and Print logo. These items are saved and will appear again in the print sheet.

  • You can set the font size and color scheme the printer will use by clicking on the Stata Headers and Footers drop-down menu and choosing Stata Fonts and Colors.

  • You can also use the translate command to generate a Post Script or PDF version of the log file. To view translator parameter setting, type:

translator query

For further help on the above, you may type the following in the Command window:

help log
help viewer
help translator

200 views0 comments

Recent Posts

See All