STATA

STATA is a statistics/data analysis program that runs on a variety of platforms.

STATA on CBS Research Grid

Name & Version

Command

Mode Type

STATA IC, SE and MP 12.1

stata

or

statase

or

statamp

Line-by-line interactive mode. Type "exit" to quit.

stata --grid_submit=batch "myprog >out"

or

statase --grid_submit=batch "myprog >out"

or

statamp --grid_submit=batch "myprog >out"

Submit job in batch in background (You can log off and job will still run in background).  Note: "myprog" is the name of the file that contains STATA commands. STATA automatically saves the output into a file named "myprog.log." "out" is an optional user speficied output file.  Without the option, you could issue a command such as: stata -B "myprog"

xstata OR xstatase OR xstatamp

Graphic mode.

How can I read economic database file on CBS Research Grid using STATA?

  1. All databases are in SAS dataset format.  You can use SAS PROC EXPORT to create a Stata dataset "mydata.dta" in your home directory from a "file" in "database" you select.  "mydata.dta" is a STATA file which can be read by STATA. 
       proc export data=database.file dbms=dta outfile='~/mydata.dta';
       run;/span>

  2. If you need to preserve special missing values, then create an XPT file, download and import it into Stata (see above). The program below creates the file mydata.xpt:
       libname mylib '~';
       libname out xport '~\mydata.xpt'; *Use "XPORT" engine in libname OUT* ;
       data out.mydata;
         set mylib.mydata;
       run;

How can I process large datasets in Stata?

PROC EXPORT of database can easily generate datasets larger than the default maximum for Stata. If you attempt to read in a dataset larger than your current maximum, you'll probably get a message such as following:

  • No room to add more observations
  • An attempt was made to increase the number of observations beyond what is currently possible.

You have the following alternatives:

  1. Store your variables more efficiently; see help compress.
  2. Drop some variables or observations; see help drop.
  3. Increase the amount of memory; see help memory.

One of the options above is to increase the amount of memory. These two commands should be sufficient:

  1. query memory. Reports your current memory allocations.
  2. set memory #[b|k|m|g] [, perm ]. Lets you allocate memory in units of gigabytes (e.g. "set memory 1g"), megabytes ("set memory 3m"), kilobytes, or bytes. The optional ",perm" tells Stata to remember this memory allocation and let it become the default for every subsequent use of Stata.

Additional Information