Stata Technical Bulletin
Long before the theoretical upper limit is reached, however, the time required for the program to search for a non-existent log
file becomes prohibitive. On a 10-Mhz 80286 IBM-compatible computer with a 28-millisecond hard drive using the regular DOS
version of Stata, if the program needs to search ten times to find a non-existent log file (i.e., autol.log through auto9.log
already exist), it will take about 15 seconds. Therefore, the user will want to periodically check these log files and erase
superfluous or redundant logs. BiTurbo and Intercooled Stata are faster.
The automatically created log files can be edited in any word processor or text editor, or can be seen via the DOS type
command. As indicated in the Stata manual, they also can be executed as a do-file, if necessary.
dm4 A duplicate value identification program
Marc Jacobs, Social Sciences, University of Utrecht, The Netherlands FAX (011)-31-30-53 4405
Some time ago I needed to know if all values of a variable were unique. tabulate did not help because there were usually
too many values involved. Although the manuals do not make it obvious, one solution is
. sort x
x quietly by x: assert _N==1
The assert command verifies a claim is true and complains otherwise. _N is the number of observations in the “data set” which,
when prefixed with by, means the number of observations in the by-group. The quietly suppresses all the output, which would
include the identity of each by-group. If the claim is false, however, the return code is nonzero.
I have constructed a small utility program to implement this. The syntax is
chkdup varname
chkdup can be found in the dm4 directory on the STB-4 diskette.
gr8 Printing a series of Stata graphs
John A. Anderson, Dept. of Civil Engineering, University of New Hampshire
[Prof Anderson has created two .bat files related to this article. They may be found in the gr8 directory on the STB-4 diskette. To enhance
speed, I have made both .bat files into binary .com files. They are also located in the gr8 directory—Ed.]
I print most of my Stata graphs at 300 dpi resolution on an HP LaserJet Series II. Depending on the complexity of the
graph, it can take quite some time for the output. The waiting is multiplied when printing a series of graphs in a single sitting.
Production, however, can be enhanced by using appropriate MS-DOS commands, creating a BAT file, and/or running GPHDOT. EXE
or GPHPEN.EXE under Windows 3.0. Depending on your needs one approach may be better than another at a particular time.
Below I have outlined procedures that I have found helpful when printing Stata graphs.
Using a single MS-DOS command line
When each graph you wish to print requires the same Stata print options, you can print all of the graphs using one MS-DOS
command line.
1. Use the COPY command to ensure that all the files you wish to print and no other files are in a single subdirectory.
2. Know where your GPHD0T.EXE and/or GPHPEN.EXE are located.
3. Use the FOR command at the DOS prompt outside of a batch file. (In the example below, the command is invoked from the
subdirectory containing GPHD0T.EXE—you can do the same thing with GPHPEN.EXE.)
Example: FOR %P IN (C:\STATA\MYGRAPH\*.*) DO GPHDOT 7.p
This command will perform gphdot (located in C : ∖STATA) on each file in the subdirectory C : ∖STATA∖MYGRAPH.
Using a “self-calling” BAT file
When each graph you wish to print requires the same Stata print options and no more than six options, the PG.BAT or
PG1.BAT files on the STB-4 disk can be used.
1. If you have MS-DOS version 3.3 or later, copy the PG.BAT file (copy PGl.BAT for MS-DOS 3.2 or earlier) from the STB-4
disk to the subdirectory where you keep GPHD0T.EXE and/or GPHPEN.EXE (usually C:\STATA).
2. Use the COPY command to ensure that all the files you wish to print and no other files are in a single subdirectory.
3. From the subdirectory containing the graphs, type the command PG and press <ENTER>.