Lecture 14 – Introduction to STATA
Our next step is to learn how to use the computer to carry out the computations for us.
In what follows,
commands you should enter appear in lower-case boldface.
Instructions for STATA
1) Formatting a disk
-(this should be done before entering STATA)-
a) double-click on the “My Computer” icon on the desktop
b) Click the icon for the drive ‘a:’
c) From the file menu, choose
d) Choose the capacity of the disk
f) When formatting is complete, click on
2) To open Small STATA
either double-click on the STATA icon, or, if there is no icon, choose Start and
then Program and then STATA.
3) First, notice that there are four windows:
STATA Results, STATA Commands, Variables and Review.
will show you the output of everything you are doing.
is the window where you enter commands.
window shows what variables are in the database you are using.
window records the commands you have used. If you want to reuse one, you can click on the
command in the review window and it will appear in the command window.
Above the windows is a toolbar with buttons.
Move the cursor to each button, without clicking, and
familiarize yourself with the functions, including the “log”, “viewer”, “do-file editor,” and “data editor.”
4) Keeping a log of your session
It is often useful to retain a complete log of your session for future
Since you are working with shared computers, it is best to keep your log on your own diskette.
Enter the command
log using a:\practice.log
This will create a file with a log of all commands you
subsequently enter and their results. That is, it is a copy of everything that shows up in the Results
Window. You can subsequently load it into Word and edit it.
5) Annotating a STATA program
. You will be writing small programs in STATA to send commands to the
computer. You will want to annotate the program you are writing to tell yourself what you have done.
Whenever you want to get out of the programming mode (in the STATA COMMANDS window) and write
a comment that STATA will not interpret as a command, you may begin a line with a
must be only one- line long.
Hit <enter> to move to a new line, and then begin the new line with a
Finish your comment, then hit enter again to enter the STATA programming mode.
The first thing we must learn to do is to enter data into a STATA data file.
There are two methods
we will learn to do this.
The first is the method you must use for data that you have developed yourself,
i.e., it is data that is not on-line anywhere, and hence cannot be down-loaded into a STATA file.
method may also be useful even for data that is online if the data set is small and you must do a lot of
cleanup of the on-line file before it can be used.
You will understand what this means after next class.