The current release of Stata is Stata 7. Consistent with Stata policy, version 7 is compatible with earlier releases of Stata, meaning that syntax you might have used with Stata 6 or earlier should work with Stata 7 just as it did with earlier releases. But, to assure compatability, be sure to put version 6.0 at the top of your old syntax files.
There are several new features in Stata 7. These include --
Stata for Windows is installed in the Research Data Management Services (RDMS) Data Center located in the basement of Smith Hall, Room 002C.
The next three sections describe the UNIX set up and the interactive and batch modes for running Stata.
Set Up. Stata 7 currently is running in test mode. To set up your account to run Stata 7, make the following modifications to your UNIX "dot" files --
Add the following two commands at the bottom of your .localalias file, also located in your home directory --
If you do not already have a file named .localenv, or you don't have a file called .localalias, both in your home directory, then issue the commands --
Note: The ~consult/proto/setup command backs up your existing .cshrc, .login, .localenv, and .localalias, if they exist. Look at the messages from the setup to see where they are backed up. If you have customized any of these files, copy your custom commands from the backups into the new files.
On UNIX, Stata may be run (1) in a full-screen environment, (2) in line-prompt mode, or (3) batch mode.
Running Stata: Full-screen Mode. To run Stata interactively in full-screen mode, you must be logged onto your unix account using an X interface such as an X-terminal, a UNIX Workstation, or an emulation of an X-terminal such as Exceed running on Windows or MacX running on a Mac. After loggin on, type --
at the UNIX prompt. Three panes appear in a new window. Figure 1 shows an image of the Stata 7 window.
You may customize the appearance of the window by clicking Prefs. For example, to change the color scheme from green on black in the "Stata Results" pane, click Prefs/General Preferences/Results.
The editor is the bottom right pane. Type Stata commands here. Figure 2 shows a simple example. The upper left pane displays the Stata commands and data that were entered, one line at a time, in the lower right pane. The lower left pane lists the names of the variables, and the Stata Results window, upper right, displays the output.
To show a high-resolution histogram, type, for example --
graph MPG, hi xlabel ylabel
The result looks like --
You may print the plot by issuing the print command -
or by clicking the right mouse button on the plot and releasing.
By default, the background of the plot is black. You may change the color scheme by clicking Prefs/Graphics Preferences.
You must be in a Stata full-screen session. Otherwise, you get no plot and no message from Stata indicating the nature of the problem. The graphics no longer work from a prompted session.
Running Stata: Line Mode. To run a prompted Stata session but without the full-screen window, type --
at the UNIX prompt. The Stata prompt is a period located at the beginning of the command line. To exit Stata, type --
. exit
at the Stata prompt. If you have unsaved work in memory, Stata will refuse to exit. You can save your worksheet, then exit --
. save filename . exitreplacing filename with the name of your file. Stata adds an extension of .dta to your filename.
Or you can force Stata to exit without saving your data by typing --
. exit, clear
at the Stata prompt.
You may enter data at the Stata prompt by typing the keyword "input" followed by a list of variable names. For example --
. input price mpg weight price mpg weight 1. 4697 25 1930 2. 8814 21 4060 3. 3667 . 2750 4. 4099 22 2930 5. end .To list the data, type list at the Stata prompt --
. list price mpg weight 1. 4697 25 1930 2. 8814 21 4060 3. 3667 . 2750 4. 4099 22 2930 .
These are the same commands used to illustrate the full-screen Stata.
Variable names must --
To add more observations, just type input with no variable list, for example --
. input
price mpg weight 5. 5079 24 2280 6. 5189 20 3280 7. 8129 21 2750 8. end .
List the cases again to confirm --
. list price mpg weight 1. 4697 25 1930 2. 8814 21 4060 3. 3667 . 2750 4. 4099 22 2930 5. 5079 24 2280 6. 5189 20 3280 7. 8129 21 2750 .
To get univariate descriptive statistics type --
. summarize Variable | Obs Mean Std. Dev. Min Max ---------+----------------------------------------------------- price | 7 5667.714 1997.448 3667 8814 mpg | 6 22.16667 1.94079 20 25 weight | 7 2854.286 688.7878 1930 4060 .
To record your session in a file, type --
. log using filenamesubstituting the name of your file for filename. The log file will be named filename.log. To stop recording commands and output in the log, type --
. log closeRunning Stata: Batch Mode. You can run a Stata job with your commands in a command file instead of typing them interactively at the Stata prompt. Stata expects a filename extension of ".do" for its command files. For example, suppose a command file named mpgtest.do contains the following commands --
use mpgtest describeTo run Stata using this command file, type --
stata -b do mpgtestThe -b flag indicates a batch run. The "do" keyword indicates to Stata to execute the commands in the file named after the do keyword, in this example, mpgtest.do. Stata assumes an extension of .do if you omit it. Output for this example is saved in a file called mpgtest.log. If your output is not written or not updated, check a file named stata.log for diagnostics.
You can accomplish the same result by using the UNIX redirection symbols, like this --
stata < mpgtest.do >! mpgtest.logThe advantage of using the UNIX redirection symbols is that you have complete control over the names of your command files and output files.
To run the job in the background, use the UNIX "&" character at the end of the command. For example --
stata < mpgtest.do >! mpgtest.log &Top
If your UNIX shell is the C shell (/usr/bin/csh), the ^Z sequence does not work correctly with Stata. Execution of Stata is suspended and you are returned to the UNIX prompt. But your UNIX commands are not written to the screen; however, their output does appear on your screen.
Search command: search search topic
Tutorial command: tutorial topic. There are 10 on-line tutorial topics. Typing tutorial from the command line in line mode returns the following output:
To run a tutorial, type . tutorial ________ filling in the blank with a name from the list on the next page. We recommend you type . tutorial intro first. After that, run the tutorials in whatever order you desire. Tutorial Description ------------------------------------------------------------------- intro An introduction to Stata graphics How to make graphs tables How to make tables regress Estimating regression models, including 2SLS anova Estimating one-, two- and N-way ANOVA and ANCOVA models logit Estimating maximum-likelihood logit and probit models survival Estimating maximum-likelihood survival models factor Estimating factor and principal component models ourdata Description of the data we provide yourdata How to input your own data into Stata
StataCorp. 2001, Stata Reference Manual: Release 7 (4 volumes), College Station, TX: Stata Corporation
StataCorp. 2001, Stata Graphics Manual: Release 7, College Station, TX: Stata Corporation
One copy of each Stata manual is kept in the Research Data Management Services (RDMS) Data Center, 002C Smith Hall.