Title
saveresults -- Save output from a command in a file on disk
Syntax
saveresults [using] filename [, options ] : command
options Description ------------------------------------------------------------------------- Main nocmd do not echo command in output replace replace existing file
Output format ps PostScript prn default printer format txt generic ASCII text log log Stata ASCII text log smcl SMCL format pdf PDF (Mac only) override_options options passed through to translate -------------------------------------------------------------------------
Description
saveresults runs command and saves a copy of the command's output in a file on disk. Depending on filename's extension, the output is translated to one of several file formats using Stata's translate command.
Options
+------+ ----+ Main +-------------------------------------------------------------
nocmd specifies that the command line not be echoed in the output.
replace specifies that filename be replaced if it already exists.
+---------------+ ----+ Output format +----------------------------------------------------
ps, prn, txt, log, smcl, and pdf (MAC only) set the output format. Specify one of these options to override the default behavior, which is to determine the output format from filename's extension. The default mappings are as follows:
option extension translator format ----------------------------------------------------- ps .ps smcl2ps PostScript prn .prn smcl2prn default printer format txt .txt smcl2txt generic ASCII text log log .log smcl2log Stata ASCII text log smcl .smcl (none) SMCL .sthlp (none) SMCL (Stata 10 up) .hlp (none) SMCL (Stata 9) pdf .pdf smcl2pdf PDF (Mac only) -----------------------------------------------------
For all other extensions txt is used as the default output format. However, note that saveresults is sensitive to the mappings defined by transmap. For example, to declare PostScript the default format for extension ".myps" you could type
. transmap define .myps .ps
override_options are passed through to translate and override any of the default options of the used translator. To find out what you can override for, say, ps, type
. translator query smcl2ps
For example, there is a logo option for most translators, which you could turn off by typing
. saveresults ..., logo(off) : command
Alternatively, you can change translator options permanently using the translator set command. See help translate for details.
Examples
. sysuse auto, clear
. saveresults test.log: describe
. type test.log
. saveresults test.ps, logo(off): describe
Author
Ben Jann, ETH Zurich, jannb@ethz.ch
Thanks for citing this software as follows:
Jann, B. (2009). saveresults: Stata module to save output from a command in a file on disk. Available from http://ideas.repec.org/c/boc/bocode/s457089.html.
Also see