====== Stata ======
The following example can be used as a job script for running Stata jobs:
#!/bin/bash
#SBATCH --job-name=my_stata_job
#SBATCH --time=0-01:00:00
#SBATCH --partition=regular
#SBATCH --ntasks=1
#SBATCH --mem=2gb
module add StataSE/17
stata-se -b do my_stata_file.do
Note that the university currently only has a license for Stata/SE, which is limited to a single CPU. Therefore, always use ''%%--ntasks=1%%'' in the job script to request a single core; requesting more cores will not improve the performance.
The input file for Stata, called ''%%my_stata_file.do%%'' in the previous job script, should be a Stata do file that contains all Stata commands. For example, it could look like:
sysuse auto, clear
summarize
graph twoway (scatter mpg weight) (lfit mpg weight)
graph export plot.ps, replace
This script loads the Automobile dataset that is installed with Stata, prints a summary about the dataset, creates a graph and finally exports this graph to the output file ''%%plot.ps%%''.