wiki:cypress/STATA

STATA

STATA is a general-purpose statistical software package created in 1985 by StataCorp

STATA on cypress is licensed to Freeman School of Business.

Run with GUI interactively

You must have X-window and ssh with X-window forwarding. See cypress/SshUsage#TunnelingXWindowsSessionviaSSH.

GUI needs faster network connection. It is not good idea to do this at outside of Campus.

Start an interactive session,

[fuji@cypress2 ~]$ idev
Requesting 1 node(s)  task(s) to normal queue of defq partition
1 task(s)/node, 20 cpu(s)/task, 2 MIC device(s)/node
Time: 0 (hr) 60 (min).
Submitted batch job 47343
JOBID=47343 begin on cypress01-063
--> Creating interactive terminal session (login) on node cypress01-063.
--> You have 0 (hr) 60 (min).
Last login: Mon Jun  8 20:18:50 2015 from cypress1.cm.cluster

The default idev session reserve a node for one hour. If you want to work on for longer time, use -t option. See cypress/using#SubmittingInteractiveJobs.

Load the module

[fuji@cypress01-063 ~]$ module load stata

Run STATA with GUI,

[fuji@cypress01-063 ~]$ xstata &

GUI window will show up.

Note that when idev session expires, your STATA session will be killed and all unsaved data will be lost.

Run on commandline interactively

Start an interactive session,

[fuji@cypress2 ~]$ idev
Requesting 1 node(s)  task(s) to normal queue of defq partition
1 task(s)/node, 20 cpu(s)/task, 2 MIC device(s)/node
Time: 0 (hr) 60 (min).
Submitted batch job 47343
JOBID=47343 begin on cypress01-063
--> Creating interactive terminal session (login) on node cypress01-063.
--> You have 0 (hr) 60 (min).
Last login: Mon Jun  8 20:18:50 2015 from cypress1.cm.cluster

The default idev session reserve a node for one hour. If you want to work on it for a longer time, use -t option. See cypress/using#SubmittingInteractiveJobs.

Load the module

[fuji@cypress01-063 ~]$ module load stata

Run STATA on commandline,

[fuji@cypress01-063 ~]$ stata 
  ___  ____  ____  ____  ____ (R)
 /__    /   ____/   /   ____/
___/   /   /___/   /   /___/   14.1   Copyright 1985-2015 StataCorp LP
  Statistics/Data Analysis            StataCorp
                                      4905 Lakeway Drive
                                      College Station, Texas 77845 USA
                                      800-STATA-PC        http://www.stata.com
                                      979-696-4600        stata@stata.com
                                      979-696-4601 (fax)

Single-user Stata network license expires 29 Feb 2016:
       Serial number:  501409275699
         Licensed to:  Freeman School of Business
                       Tulane University

Notes:
      1.  Unicode is supported; see help unicode_advice.

. 

Use exit command to finalize STATA.

Note that when idev session expires, your STATA session will be killed and all unsaved data will be lost.

Run STATA in batch mode

First, you should become familiar with do-files.

Make sure your do-files work correctly. It is recommended to test your do-files on the local machine or on an interactive session with a small data for a short time.

Suppose we have hello.do file that contains:

[fuji@cypress2 ~]$ cat hello.do 
clear
display "Hello, STATA!!!"
exit

SLURM script will be:

#!/bin/bash
#SBATCH --partition=defq        # Partition
#SBATCH --qos=normal            # Quality of Service
#SBATCH --job-name=STATA        # Job Name
#SBATCH --time=24:00:00         # WallTime
#SBATCH --nodes=1               # Number of Nodes
#SBATCH --ntasks-per-node=1     # Number of tasks (MPI processes)
#SBATCH --cpus-per-task=2       # Number of processors per task OpenMP threads()
#SBATCH --gres=mic:0            # Number of Co-Processors

module load stata

stata -b do hello

Submit a job

[fuji@cypress2 ~]$ sbatch slurmscript 

'slurmscript' is the file name of the above SLURM script. The results will be stored in 'hello.log'.

STATA-MP

Stata can run with multiple threads. You can check the license info by 'creturn list' command on stata-window.

      c(processors) = 8                          (Stata/MP, set processors)
      c(processors_lic) = 8

The example above shows the default is 8 cores. So

#!/bin/bash
#SBATCH --partition=defq        # Partition
#SBATCH --qos=normal            # Quality of Service
#SBATCH --job-name=STATA        # Job Name
#SBATCH --time=24:00:00         # WallTime
#SBATCH --nodes=1               # Number of Nodes
#SBATCH --ntasks-per-node=1     # Number of tasks (MPI processes)
#SBATCH --cpus-per-task=8       # Number of processors per task OpenMP threads()
#SBATCH --gres=mic:0            # Number of Co-Processors

module load stata

stata-mp -b do parappelcode
Last modified 17 months ago Last modified on 11/22/22 14:10:43

Attachments (1)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.