STATA: Access and Documentation

A. Colin Cameron, Dept. of Economics, Univ. of Calif. - Davis

This September 1999 help sheet gives information on


WHAT IS STATA

Stata is a regression package that is used particularly by biomedical and economics researchers using cross-section and panel data. It is becoming the most popular package for such purposes as it has many of the latest methods and is relatively easy to use.

For extensive information go to http://www.stata.com/
 

STATA ACCESS AT U.C.-DAVIS

Stata is available on the Social Science Data Service (SSDS) Unix computer Black for faculty and graduate students in the Departments of Economics, Political Science and Sociology. You need an account on Black to access this. The license for Stata permits a limited number of users at anyone time. To date this has not been a problem.

Windows versions of Stata are available for PC under Windows and Mac.
Some computer labs such as the Department of Economics lab have Windows Stata.
The university has a site-license agreement for Stata.
This site-license also permits cheaper purchase of Stata manuals.
Go to the university site-license coordinator at  https://software.ucdavis.edu:443/lowres/search.cfm
 

STATA DOCUMENTATION

For details on obtaining information about Stata go to  sthelp.html
 

USING STATA ON SSDS UNIX MACHINE BLACK

Telnet to black.ucdavis.edu and login

For interactive use give the command
   stata -p0
where the 0 in p0 is a zero.
and to quit give command
  exit, clear

For batch use with program in file myprog.do give the command
   stata -b do myprog.do
This will execute the commands in myprog.do and put output in myprog.log

To make a batch file use the editor pico if it is available.
(This is easier to use that some of the other Unix editors. It is similar to pine).
A simple way to run Stata in batch mode is to run through a cycle of three commands:

     stata -b do myprog.do    Runs the Gauss program in batch mode
     pico myprog.log     Lets you see the results if they are in myfile.log
     pico myprog.do   Lets you edit and make changes to the Gauss program

You can use the up arrow key to save having to retype these commands.

As an intermediate approach while in interactive use of Stata one can
run a batch file with the Stata command rin.  For example, run myprog.do

Useful Unix commands include ls which lists the directory, cp to copy a file, and rm to remove a file.
 

SIMPLE EXAMPLE

The following example generates 100 draws from a normal distribution with mean 4 and standard deviation 2
and then gives a summary of the generated data.
  clear
  set obs 100
  gen normal24 = 4 + 2*invnorm(uniform(  ))
  sum
  exit, clear
 

For further information on how to use Stata go to
   http://www.econ.ucdavis.edu/~cameron