Stata in Serial
To access Stata on the clusters, you must first type: module load stata
A sample PBS script that shows a 1-CPU Stata job looks like this:
#PBS -N stata1
#PBS -q route
#PBS -l nodes=1,walltime=24:00:00
#PBS -M your-email-address
#PBS -m abe
#PBS -W x=GRES:stata+1
#PBS -V
#
echo "I ran on:"
cat $PBS_NODEFILE
#
#cd to your execution directory first
cd /home/your-user-name/your-stata-directory
#
stata -b "do my-stata-file.do"
#
Note that your Stata job will not have any access to a graphical display or terminal, so all of your input must be handled by one .do file (which can call other .do files) and all of your output must be written to either a file or the screen (standard out) by Stata.
The example file my-stata-file.do looks like this:
use http://www.stata-press.com/data/r9/auto
sort foreign
by foreign: summarize price mpg
After creating the sample .do file and the PBS script (as shown above), you can submit your job using the qsub MyPBSscript command (where MyPBSscript is whatever you named your PBS script) and Stata will write the output to my-stata-file.log unless you tell it to do otherwise.



