Command Line Usage
Running DO Files¶
Assuming the uploaded DO file is reg.do
. You can directly run reg.do
by executing the following code:
Please make sure to correctly set the paths for input and output files.
Is it stata-mp
or stata
?
stata-mp
corresponds to Stata's MP version (multi-core version), which has faster execution speed (and a higher price).
stata
corresponds to Stata's SE version (single-core version).
It is generally recommended to use stata-mp
by default.
Getting command not found
error
Cause
- The Stata application has not been added to the
PATH
environment variable. - Stata is not installed on this server.
Solution
Please contact the administrator to install Stata and create a symbolic link to the executable in /usr/bin
.
Logging Stata Output (LOG)¶
Suppose we want to save all the output from Stata during its execution to the file /home/user/project/log.smcl
. Simply add the following code at the beginning of the DO file.
If you want to replace the existing log file with each run:
If you want to append the log from each run to the existing log file:
Note that SMCL is a Stata-specific log format that needs to be opened with Stata. You can also output in TXT format:
Running Stata in the Background¶
If you don't need to see the results in the SSH terminal and only want to view the log file after the code has finished running, you can use the following command:
It is recommended to combine this approach with the "Logging Stata Output" method mentioned above.