What is Stata?

Stata is a general purpose statistical packages, that provides data management, statistical analysis, graphics, simulations, regression, and custom programming.

Stata is licensed through StatCorp (www.stata.com) . ITS has subscribed a Stata/MP license to support HKU staff and students’ research projects, so that their Stata computation can be speeded up with multicore parallelism on the HPC2021 cluster system. You can visit the Stata/MP Performance Report for a complete assessment of Stata/MP’s performance that including command-by-command statistics.

Permission of using Stata on HPC2021

In order to run Stata in the HPC systems, user must be assigned in the group of “stata“. Please send your request to group-its-hpc@hku.hk to arrange the access.

(Note on the STATA license as it is becoming an FAQ) The license subscribed by ITS is only for use on the HPC2021 cluster, and the cluster is for research work only (aka not for group project/coursework). We do not have license for other computers (aka not your personal computer or computer owned by other HKU departments).

Using Stata in HPC system

To use Stata in the HPC cluster system, you must first load the module to setup required environment variables.

System STATA version Command
HPC2021 16.1 module load stata/16.1
17.0 module load stata/17.0

Stata Commands

stataThe Command Line interface (CLI) version of Stata
stata-mpThe multiple core CLI version of Stata
xstataThe Graphical User Interface (GUI) version of Stata
xstata-mpThe multiple core GUI version of Stata

The Stata MP16 3-user network license restricted 3 concurrent usage each with maximum 16 cores. User must request the appropriate license either from the command line (Interactive session) or as part of the batch script (batch mode). If no license is available, a job will be held pending until a license becomes available.

  1. Running Stata jobs with SLURM (batch mode)

    Be reminded that do not run computationally intensive processes on the frontend nodes. You should submit the Stata simulations through the job scheduling system. Sample SLURM scripts for submitting Stata jobs are available at /share1/stata/sample/.

    #SBATCH --job-name=StataMP 	 	 
    #SBATCH --nodes=1	 	 
    #SBATCH --tasks-per-node=16      # for Stata MP16 (max. 16 cores) 	 	 
    #SBATCH --output=%x.out.%j       # Standard output 	 	 
    #SBATCH --error=%x.err.%j        # Standard error 	 	 
    #SBATCH --licenses=stata:1       # Use 1 Stata/MP license 	 	 
    module load stata	 	 
    stata-mp -b do stata_parallel.do	 	 
  2. Graphical User Interface
    $ ssh -X <username>@hpc2021-io1.hku.hk 	 	 
    $ module load stata/17.0 
    $ xstata my-stata.do	 	 


Additional Information

Stata website: https://www.stata.com/
Stata official documentation: https://www.stata.com/features/documentation/
STATA Tutorials in Youtube: