ECO3121A: Introductory Econometrics
Third Tutorial Notes: Introduction to Stata
26/10/2010 PAN Jutong
1. Interface
Having opened the Stata, you can see its default interface has four windows: review,
results, command, and variables. Let’s try to enter some command, and see what
responses they show.
[How to import the data into Stata]
Type
insheet using E:\ECO3121A\HPRICE1.txt, clear
in the command window, then press “enter” key. 1
The displays of other windows, review, results, and variables, have changed. Review
shows what commands we have entered before. Variables show the variables that the
data include. Results show the results of the command we type.
[How to browse and edit data]
Once we import the data into Stata, we can browse and edit it, by clicking the icons
“Data Editor (Browse)” or “Data Editor (Edit)” in the toolbar. It displays the data and
variables in a single sheet. In “Data Editor (Browse)”, you can only browse the data
but cannot make any changes to the data. In “Data Editor (Edit)”, you can do some
simple editing on the sheet like the way we use Excel. In most cases, we do not edit
the data, unless limited values have to be adjusted.
2. Two equivalent ways of using commands
Stata provides two equivalent ways of using its built-in commands. The first one is to
type the command in the command window, as we did above. The second one is to
select the command in menu.
For example, instead of typing “insheet using …”, we can click in menu, step by step,
File – Import – ASCII Data created by a spreadsheet, and then a user-friendly
dialogue will appear.
Tips: enables the option of “replace the data in memory” if you have already imported
some data. 2
Almost all built-in commands can be accessed by either directly typing or clicking
menu. Clicking menu might seem easy to use, because you even need not to remember
the commands. However, I suggest you type commands directly as often as possible.
You will learn the benefit of remembering some common commands once we talk
about “Do file” later.
3. Commands
In this part, I will introduce several important commands.
1 The location “E:\ECO3121A\” in the command is only for my reference. To do the homework, you
need to replace it with your own location where you place the data file.
2 This option can also be achieved by typing “, clear”, as we did above.
1