Size: 694
Comment:
|
Size: 750
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
= Stata Logs = | = Stata Log = |
Line 3: | 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 9: | Line 9: |
== Basic Logging == | == Usage == === Rich Logs === Stata supports a rich log format, using the `.smcl` file extension. |
Line 12: | Line 18: |
log using "path/to/file", replace | log using "path/to/file.smcl", replace log close }}} |
Line 14: | Line 22: |
// do something | |
Line 16: | Line 23: |
log off di "Rather than running commands `quietly`, temporarily turn off logging. log on |
|
Line 20: | Line 24: |
// do something else | === Text Logs === |
Line 22: | Line 26: |
Use the '''`text`''' option. {{{ log using "path/to/file.txt", replace text |
|
Line 23: | Line 31: |
translate "path/to/file.smcl" "path/to/file.log" | |
Line 30: | Line 37: |
== Listing == | == Temporarily Disabling Logging == |
Line 32: | Line 39: |
The `list` command abbreviates variables and applies formats to data. To override the default abbreviation limit of 8 characters, use: | Some output should not be recorded. Try: |
Line 35: | Line 42: |
list very_long_variable_name, abbrev(50) | log off display "Rather than running commands quietly, temporarily turn off logging. log on |
Line 37: | Line 46: |
---- == See also == [[https://www.stata.com/manuals/dlog.pdf|Stata manual for 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