Sometimes you want to save a big chunk of output. To do this, you need to use a log file – this is a sort of nicely formatted output file.
This is what a log can look like:

More informationhelp log |
Start a new log
Use the following command in your do-file to start a new log (the path specifies where you want to log to be saved):
log using "pathfilename.smcl" |
Change “pathfilename” to the full path (i.e. the folder on your computer that you want the log to end up in), and specify the log name of your choice, such as:
log using "C:\Users\yerik\Stata Guide\Log200715.smcl" |
Close a log
Once you have produced the output you want, stop the log with this command:
log close |
Continue with or replace a log
And here is how you open up an old log and add more stuff to it:
log using "pathfilename.smcl", append |
For example:
log using "C:\Users\yerik\Stata Guide\Log200715.smcl", append |
Or, if you prefer to open up the old log and overwrite it:
log using "pathfilename.smcl", replace |
For example:
log using "C:\Users\yerik\Stata Guide\Log200715.smcl", replace |
View your log
Want to view your log? This is how:
view "pathfilename.smcl" |
For example:
view "C:\Users\yerik\Stata Guide\Log200715.smcl |