The Office of Population Research at Princeton University

August 8, 2008


Administration
Faculty
Staff
Students
Jobs


Projects
Seminars
Working Papers


Prospective  Students
Programs
Courses
Course Schedule


Data Archive
Library
Pop Index


Calendar


CRCW
CHW
CMD
PUM
OPR Mail
OPR Mail - New

Search

 

Stata

Stata is software for analyzing data. It provides statistical, graphical, and data-management capabilities and is fully programmable. Its best features include: speed, power, and simplicity for beginners. OPR has Stata 8.0 for UNIX (both ascii windows and X windows versions), installed on lotka, as well as Stata 8.0 for Windows on desktop PC's.

General Information about Stata: Learning Stata:

Stata Special Edition

The Special Edition of Stata for large datasets is now available on OPR's Unix and Windows servers.
  • On Unix type xstata-se from an xterm or stata-se for a text interface. (You can still type xstata or stata for regular Stata).

  • On Windows, you access the network version by typing \\sheps\stata-se\wsestata.exe into the Start->Run box. (You can still access regular Stata at \\sheps\stata\wstata.exe.)

The following table shows the main differences between regular (intercooled) Stata and the new Special Edition:

ItemIntercooled SE
Variables2,04732,766
Strings80 chars244 chars
Matrices800 x 80011,000 x 11,000

The Stata dataset format has changed, but Stata/SE can read regular Stata files and regular Stata has been updated to read Stata/SE files, provided they are not too big. If you are using Stata/SE, you can save your files in regular Stata 7 format by using the command: save myfile, intercooled. If you need to save the file in Stata 6 format, use "old" instead of "intercooled". Note that Stata will not allow you to save the data in intercooled or Stata 6 format if the data do not comform to the limits of those versions.

For more information see http://www.stata.com/news/statase.html.

Running Stata on OPR UNIX Server

To access Stata on the Lotka server, issue the following command on the prompt:

    
  % stata    (for the ascii version)
  % xstata   (for the XWindows version)
      

To end your Stata session, enter the following command within Stata:

    
  . exit, clear
      

To execute Stata in the background (batch mode), type the following command. Substitute filename with the name of your own file.

    
  % stata -b do filename &
      

The above line tells Stata to execute the commands in filename.do in the background, and route the output to filename.log in the same directory.

Configuring Stata on Your PC and Coale

The new application server, Coale, makes running large computing jobs much easier by not hogging the resources on your PC. Unfortunately since it is a separate system, various configurations and programs you may have installed on your PC are not available on Coale. Additionally, anything new you install on one system is not reflected on the other. There is, however, a way around this by moving a few files and directories from the C:\ drive on your PC to your Z:\ drive and telling Stata to look for them there.
  1. Move the C:\ado directory and all its contents from your C:\ drive to your Z:\ drive.
  2. Change the target for your Stata 8 shortcut on your PC as well as on Coale by right-clicking the icon, selecting "Properties", then "Shortcut." Change the "Target" box to:
    	C:\Stata8\wsestata.exe run "z:\ado\personal\profile.do"

    Then click "Apply", then "OK". The "run" command is the same as the "do" command except no output is sent to the Results window.

  3. Create a file called "profile.do" in your "Z:\ado\personal" directory. At minimum, this file needs to have these lines:
        sysdir set OLDPLACE z:\ado
        sysdir set PERSONAL z:\ado\personal
        sysdir set PLUS     z:\ado\stbplus
    
    You can put other commands that you want Stata to run every time you start it in this file as well. Make sure that the directories indicated above actually exist (for Stata 8 users who never used Stata 7, the last line might be "z:\ado\plus")
  4. Now when you install a new ado on your PC, the same command will automatically be available to you on Coale and vice-versa. Also, any changes you want to make to your profile.do will automatically be updated for both systems. Another benefit is that when you use any computer from which you can access your Z:\ drive (such as those in Rm. 217), you can issue this command from the Command window in Stata:
    	run z:\ado\personal\profile.do
    
    And have use of all your previously installed commands.

Getting Help

Stata has an excellent on-line help facility. Typing

  . help 
      

at the Stata dot prompt gives help for the help command.

To get a table of contents of the entire on-line help system arranged by subject, type:

  . help contents
      

Typing

  . search topic
  . net search topic
      

Stata will provide you with all the sources of information that have to do with that particular topic. The "net" version of this command will also search Stata's web site.

To get help on a specific Stata command, type:

  . help command
      

Useful Links

  • Stata Corporation web site
  • Sample Session: Take a look at a sample Stata session.
  • FAQs: Browse through the frequently asked questions
  • Statalist: Become a member of the list or browse the Statalist archives. Statalist is an active group of users who exchange via e-mail about using Stata. Follow the links to join the list.
  • Stata Technical Bulletin: Subscribe to the STB or to obtain STB programs. Stata Technical Bulletin is a printed journal that contains articles written by StataCorp, Stata users, and others. These articles include Stata commands(ado-files), programming tutorials, illustration of data analysis techniques, etc.
  • Net Courses: Take a look at the courses offered on Stata.
  • Updates: Update your copy of Stata over the internet.
top
Mail: Office of Population Research, Princeton University, Wallace Hall, Princeton NJ 08544
Phone: (609) 258-4870  •  Fax: (609) 258-1039  •  Email: webmaster@opr.princeton.edu