Stata ----- Stata_ is a powerful general purpose package for data analysis and data management. Stata covers a wide range of statistical techniques. The package analyzes data quickly by reading all data into memory which may be managed dynamically during a session. .. _Stata: https://www.stata.com/ Interactive Mode ################ 1. SSH onto the *mercury* login node with (optional) X11 forwarding :code:`ssh -X @mercury.chicagobooth.edu` 2. Request an interactive session on a compute node :code:`srun --pty bash --login` 3. Load the module with the desired version of Stata :code:`module load stata/18.0` 4. Start Stata by typing one of the following: * :code:`stata-se` for STATA Special Edition. * :code:`stata-mp` for STATA Parallel Edition. * :code:`xstata-se` for STATA Special Edition with X-Windows * :code:`xstata-mp` for STATA Multiprocessing with X-Windows Batch Mode ########## .. #. Navigate to the directory with your Stata program that you want to run. .. #. Run the desired Batch Mode version of Stata: .. For regular Stata, type :code:`batch-stata ` at the prompt, where :code:`program.do` is the name of your program file. .. For Stata Special Edition, type :code:`batch-stataSE ` at the prompt, where :code:`program.do` is the name of your program file. .. For Stata Parallel Edition, type :code:`batch-stataMP ` at the prompt, where :code:`program.do` is the name of your program file. .. If the program executes without any syntax errors, Stata creates an output file called :code:`.log` in the current directory and a second output file named batch.out in your home directory. .. If the program contained errors, an error file named :code:`batch.err` will be created in your home directory. To run Stata in batch mode, generate a submission script similar to the one below, and run by typing :code:`sbatch submit.sh`. .. code-block:: bash :caption: submit.sh #!/bin/bash #SBATCH --account=phd #SBATCH --mem=1G #SBATCH --time=0-01:00:00 #SBATCH --job-name=example_job # Load the necessary software modules module load stata/18.0 # create a new scratch directory for this job scratch_dir="/scratch/${SLURM_JOB_USER}/${SLURM_JOB_ID}" mkdir -p $scratch_dir # use scratch dir to store tmp files export STATATMP=$scratch_dir # run script dofile='program.do' srun stata-se -b do $dofile # remove scratch directory when done rm -r $scratch_dir