Differences between revisions 3 and 6 (spanning 3 versions)
Revision 3 as of 2021-03-16 18:29:07
Size: 511
Comment:
Revision 6 as of 2023-06-07 20:29:04
Size: 653
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
## page was renamed from StataLogs
= Log Files =
= Stata Log =
Line 4: Line 3:
Stata outputs to a terminal emulator. Output can be recorded into a markup file, which can be rendered into file formats including raw text. The '''`log`''' command records commands and command output, and writes them to a log file.
Line 10: Line 9:
== Built-in Logging == == Usage ==



=== Rich Logs ===

Stata supports a rich log format, using the `.smcl` file extension.
Line 13: Line 18:
log using "path/to/file", replace log using "path/to/file.smcl", replace
log close
}}}
Line 15: Line 22:
// do something
Line 17: Line 23:

=== Text Logs ===

Use the '''`text`''' option.

{{{
log using "path/to/file.txt", replace text
log close
}}}

----



== Temporarily Disabling Logging ==

Some output should not be recorded. Try:

{{{
Line 18: Line 43:
di "Rather than running commands `quietly`, temporarily turn off logging. display "Rather than running commands quietly, temporarily turn off logging.
Line 20: Line 45:

// do something else

log close
translate "path/to/file.smcl" "path/to/file.log"

Stata Log

The log command records commands and command output, and writes them to a log file.


Usage

Rich Logs

Stata supports a rich log format, using the .smcl file extension.

log using "path/to/file.smcl", replace
log close

Text Logs

Use the text option.

log using "path/to/file.txt", replace text
log close


Temporarily Disabling Logging

Some output should not be recorded. Try:

log off
display "Rather than running commands quietly, temporarily turn off logging.
log on


CategoryRicottone

Stata/Log (last edited 2025-10-24 17:27:01 by DominicRicottone)