Stata 15 help for print

[R] translate -- Printing files


print filename [, like(ext) name(windowname) override_options ]

filename, in addition to being the filename to be printed, may be specified as @Result to mean print the Results window, @Viewer to mean print the topmost Viewer window, and @Graph to mean print the topmost Graph window. Unix(GUI) users should use the name option when specifying @Viewer or @Graph to ensure the correct window is printed when there is more than one viewer or graph open (see the Technical note for Unix(GUI) users).


print prints log and SMCL files.


like(ext) specifies how the file should be translated to a form suitable to print. The default is to determine the translation method based on the extension of filename. Thus, mylog.smcl is translated according to the rule for translating smcl files. (The rule in this case is translate's smcl2prn translator.)

Rules for the following extensions are predefined:

.txt Assume input file contains plain text .log Assume input file contains Stata log text

.smcl Assume input file contains SMCL

If you wish to print a file that has an extension different from those listed above, you can define a new extension, but you do not have to do that. If file contained text, you could type print, like(txt). On the other hand, you could type

. transmap define .me .txt

to tell Stata that .me files are always treated like .txt files.

Option like() overrides the recorded rules.

name(windowname) specifies which window to print when printing a viewer or graph. Omitting the name() option prints the topmost viewer or graph (Unix(GUI) users: see Technical note for Unix(GUI) users). The name() option is ignored when printing the Results window.

The name for a window is inside parentheses in the window title. For example, if the title for a Viewer window is Viewer (#1) [help print], the name for the window is #1. If the title for a Graph window is Graph (MyGraph), the name for the window is MyGraph. If a graph is an asis or graph7 graph where there is no name in the window title, then specify "" for windowname.

override_options refers to translate's override options. print uses translate to translate the file into a format suitable for sending to the printer. To find out what is overrideable for X files, type "translator query X2prn". For example, to find out what is overrideable for printing smcl files, type "translator query smcl2prn". See translate.


. print mylog.smcl

. print mylog.log

. print @Results

. print @Viewer

. print @Graph, name(MyGraph)

Technical note for Unix users

As shipped, Stata assumes you have a PostScript printer attached to your Unix computer and that the Unix command lpr(1) can be used to send PostScript files to it. If you need to change that, see printer. For those who have read that, you will remember that one of the examples was

. printer define prn ps "lpr -Plexmark @"

You can also define multiple printers. In that case, print has syntax

print filename [, like(ext) printer(printername) override_options ]

Technical note for Unix(GUI) users

X-Windows does not have a concept of a window z-order which prevents Stata from determining which window is the topmost window. Instead, Stata determines which window is topmost based on which window has the focus. However, some window managers will set the focus to a window without bringing the window to the top. What is the topmost window to Stata may not appear topmost visually. For this reason, you should always use the name() option to ensure the correct Viewer or Graph window is printed.

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index