Stata Technical Bulletin
27
Estimated regression slope
Monte Carlo sample
Figure 5: Standard t-table 90% confidence intervals
Figure 6
Figure 5
tt1 Teaching beginning students with Stata
Ted Anagnoson, California State University, LA & Richard DeLeon, San Francisco State University
Problem and Solution
Many instructors face a situation where students have to do basic data analysis, but their keyboarding skills may be
rudimentary, their interest in learning how to change directories or set maxobs may be limited, etc. Here is a system we found in
the Sociology/Political Science computer lab at the University of California, Santa Barbara, which was used in a first year class
of 300 students who came in on their own time to a 40-station microcomputer lab to run Stata and do frequency distributions,
and two- and three-way cross-tabulations. Our thanks to Joan Murdoch, Associate Director of the lab, for passing along this idea.
Every microcomputer had a batch file which automatically changed to the subdirectory for the class with the class’s data
file(s) in it and ran Stata with a prof ile.do file implied. An example of pols480.bat:
cd d:\pols480
d:\stata\stata run profile
A profile.do file is placed in the ∖P0LS480 (class) subdirectory which sets maxobs for the particular dataset, uses it,
and sets up a log file. At UCSB each microcomputer has its own printer, and log using prn: is used to print results as each
student goes along. profile.do:
set maxobs 1500
use campfin [or whatever file is being used]
log using prn:
Thus each student turns on the computer, types pols480 and finds that Stata is loaded, the data file is already in memory, no
memory reconfiguration is necessary, and a log file is going to print all results on the printer.
Stata’s do-files can be used to abbreviate the tabulate command so that students need not enter options, etc. Some
examples are
Filename
freq.do
cross2.do
cross3.do
Contents
tab %_1
tab *Z_1 %_2, row col chi2
sort
by 7»_3: tab 7»_1 7»_2, row col chi2
Thus a typical student session might consist of only three or four commands:
C:\> pols480 [from the DOS prompt]
. des [in Stata]
. do freq varname
. do cross2 varl var2
. do cross3 varl var2 var3
. exit